-2

I have this json file-

[
  {
    "symbol": "AAPL",
    "quantity": 100,
    "tradeType": "BUY",
    "purchaseDate": "2019-01-02"
  },
  {
    "symbol": "MSFT",
    "quantity": 10,
    "tradeType": "BUY",
    "purchaseDate": "2019-01-02"
  },
  {
    "symbol": "GOOGL",
    "quantity": 50,
    "tradeType": "BUY",
    "purchaseDate": "2019-01-02"
  }
]

and I need to prepare the list of all symbols for example if

[{ "symbol": "MSFT"}, { "symbol": "AAPL"}, { "symbol": "GOOGL"}]

then output should be-

["MSFT", "AAPL", "GOOGL"]

Can anyone help me how I can extract "symbol" field value and store above output in list?

  • [Why is β€œCan someone help me?” not an actual question?](http://meta.stackoverflow.com/q/284236) – Hovercraft Full Of Eels May 08 '22 at 19:27
  • Better to show your own attempt, and then tell the specific problems that you may be having with that attempt. You can find similar questions and answers [here](https://www.google.com/search?q=site%3Astackoverflow.com+java+jsonarray+to+list). You may also want to check out [these links on parsing JSON with Java](https://www.google.com/search?q=site%3Astackoverflow.com+java+parse+json) – Hovercraft Full Of Eels May 08 '22 at 19:31

0 Answers0