Issue
This Content is from Stack Overflow. Question asked by emma
I have Sampling_Instructions
that contains an array of objects according to the example I listed below and my goal is to display only the Body information.
Pay attention,
green apple
What is the right way to do this?
"Sampling_Instructions":"[{"Timestamp":"2022-09-18T11:50:00","From_User_ID":20,"Type":"Sampling_Instructions","Body":"Pay attention"},
{"Timestamp":"2022-09-10T11:20:00","From_User_ID":20,"Type":"Sampling_Instructions","Body":"green apple"}]",
Solution
Use JSON parse like this
let samplingInstructions = JSON.parse(JSON.parse( sampling instruction ))
console.log(samplingInstructions[0].Body)
This Question was asked in StackOverflow by emma and Answered by AbdulAzeem It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.