-2

I have a JSON string as follows:

`

var json_string = 
[
{"ColumnName": "Column1", "Counts": 5, "Percentages": 30},
{"ColumnName": "Column2", "Counts": 10, "Percentages": 20},
{"ColumnName": "Column3", "Counts": 7, "Percentages": 40},
{"ColumnName": "Column4", "Counts": 45, "Percentages": 12},
{"ColumnName": "Column5", "Counts": 32, "Percentages": 32}
]

`

How do I get the value Column4's Counts value?

SoftwareDveloper
  • 559
  • 1
  • 5
  • 18

1 Answers1

-1

You can do it like this: json_string[3]["Counts"] or json_string.find(a => a.ColumnName === "Column4").Counts;

Korfu
  • 673
  • 5
  • 20