Javascript has a built in JSON parse for strings, which I think is what you have:

var myObject = JSON.parse("my json string");

to use this with your example would be:

var jsonData = JSON.parse(myMessage);
for (var i = 0; i < jsonData.counters.length; i++) {
    var counter = jsonData.counters[i];
    console.log(counter.counter_name);
}

Here is a working example

EDIT: There is a mistake in your use of for loop (I missed this on my first read, credit to @Evert for the spot). using a for-in loop will set the var to be the property name of the current loop, not the actual data. See my updated loop above for correct usage

IMPORTANT: the JSON.parse method wont work in old old browsers - so if you plan to make your website available through some sort of time bending internet connection, this could be a problem! If you really are interested though, here is a support chart (which ticks all my boxes).

Answer from musefan on Stack Overflow
🌐
W3Schools
w3schools.com › js › js_json_parse.asp
JSON.parse()
... <p id="demo"></p> <script> ... using the JSON.parse() on a JSON derived from an array, the method will return a JavaScript array, instead of a JavaScript object....
Discussions

Parsing JSON Request. Find object in array
My question: I want to access a value in a certain array repetition. This is the JSON: { "d": { "results": [{ "Id": 1, "Value": "XX" } ], [{ "Id": 2, "Value": "YY" } ] } } I would like to do something like this: var jsonData = JSON.parse(responseBody); console.log(jsonData.d.results[Id='1'].Value); ... More on community.postman.com
🌐 community.postman.com
0
1
February 6, 2022
Parse JSON into array
Your code is almost correct. Firstly, you don't have to use the local() and setLocal() functions, because local variables are accessible outside of JavaScript action. Secondly, you need to declare the titles variable as an array. var data = JSON.parse(http_data); var titles = []; titles = data.map(el => el.title); More on reddit.com
🌐 r/tasker
9
1
January 23, 2021
Large array of objects in JSON for JSON.parse() in JavaScript

The issue is that JSON.parse takes a string; you're passing it an object literal. It's used for taking a string that contains JSON-formatted data and converting it into a JS object. But what you have here doesn't need to be parsed; you can just set a variable equal to it directly.

Alternatively, wrap the entire contents inside JSON.parse() with single-quotes or back-ticks (the ` character).

creating a dictionary with the first value as a key, and the 2nd and 3rd fields concatenated somehow as the value.

Don't concatenate them; use objects.

More on reddit.com
🌐 r/learnprogramming
2
1
August 20, 2016
why is JSON.parse way slower than parsing a javascript object in the source itself?
These answers missed the most significant difference, run-time vs. compile time. There is a lot of overhead with parsing JSON since you are doing string parsing and constructing objects at runtime. The compiler cannot optimize this. Whereas, if you're loading a JS source file, the JIT compiler is able to kick in before the program is even executed. More on reddit.com
🌐 r/javascript
35
67
June 3, 2017
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › JSON › parse
JSON.parse() - JavaScript - MDN Web Docs
The JSON.parse() static method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned.
🌐
Tutorial Republic
tutorialrepublic.com › javascript-tutorial › javascript-json-parsing.php
JavaScript JSON Parsing - Tutorial Republic
JSON is the most popular and lightweight data-interchange format for web applications. In JavaScript, you can easily parse JSON data received from the web server using the JSON.parse() method.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-json-string-to-array-of-json-objects-using-javascript
Convert JSON String to Array of JSON Objects in JavaScript - GeeksforGeeks
August 5, 2025 - This allows developers to work directly with the data, enabling easier manipulation, analysis, and display of information. Below are some common methods that are used to convert JSON strings to array of JSON objects: Using the JSON.parse() method, ...
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-parse-json-array
How to parse a JSON Array in JavaScript | bobbyhadz
March 4, 2024 - Use the JSON.parse() method to parse a JSON array, e.g. JSON.parse(arr). The method parses a JSON string and returns its JavaScript value or object equivalent.
🌐
W3Schools
w3schools.com › js › js_json_arrays.asp
JSON Arrays
In JSON, array values must be of type string, number, object, array, boolean or null. In JavaScript, array values can be all of the above, plus any other valid JavaScript expression, including functions, dates, and undefined.
Find elsewhere
🌐
YouTube
youtube.com › watch
Easy JavaScript - How to parse an array of JSON data (42) - YouTube
Welcome to the 42nd Easy JavaScript tutorial, part of EasyProgramming.net. We looked at the for...in loop last time, and I mentioned that you can take it one...
Published   April 8, 2017
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › JSON › stringify
JSON.stringify() - JavaScript - MDN Web Docs
The JSON.stringify() static method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified.
🌐
Pluralsight
pluralsight.com › tech insights & how-to guides › tech guides & tutorials
Convert a JSON File to an Array in React | Pluralsight
March 31, 2025 - JSON is a suitable file format for the data exchange between client and server, and contains the key-value pair as a string value. The JavaScript function parse() converts the string to a JavaScript object, and map() iterates through an array ...
🌐
Udacity
udacity.com › blog › 2022 › 12 › parsing-json-in-javascript.html
JSON Parse in JavaScript | Udacity
March 22, 2023 - Overall, the reviver function is a great spot to include custom business logic and other transformations on the JSON string being parsed into JavaScript. In addition to all the above, note that JSON.parse() can handle JSON arrays as well (an array is an object, after all):
🌐
EDUCBA
educba.com › home › software development › software development tutorials › javascript tutorial › json parse array
JSON Parse Array | How does JSON Parse Array Work in Javascript?
April 13, 2023 - First, the json is to read the user data from the web servers and displayed the data in the web page first is converted into the string format using JSON.stringify() and next is again converted string into arrays using JSON.parse() method.This ...
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
ZetCode
zetcode.com › javascript › jsonparse
JavaScript JSON.parse - Parsing JSON Strings
The JSON.parse method parses a JSON string and creates a JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned.
🌐
JSON Formatter
jsonformatter.org › json-parser
JSON Parser Online to parse JSON
JSON Example with all data types including JSON Array. ... JSON.Parse() is javascript method for parsing JSON which converts to JavaScript objects.
🌐
Postman
community.postman.com › help hub
Parsing JSON Request. Find object in array - Help Hub - Postman Community
February 6, 2022 - This is the JSON: { "d": { "results": [{ "Id": 1, "Value": "XX" } ], [{ "Id": 2, "Value": "YY" } ] } } I would like to do something like this: var jsonData = JSON.parse(responseBody); console.log(jsonData.d.results[Id='1'].Value); ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › js-json-parse-stringify
How To Use JSON.parse() and JSON.stringify() | DigitalOcean
November 24, 2021 - JSON.parse() takes a JSON string and transforms it into a JavaScript object.
🌐
FusionReactor
fusion-reactor.com › home › why coldfusion monitoring, licensing, and consultancy should never be separate services › how to parse json data in javascript
How to Parse JSON data in JavaScript - FusionReactor Observability & APM
March 10, 2022 - It can contain escape characters ... true }} ... There are a few ways you can parse data in JavaScript. With the JSON.parse() method, you can quickly parse JSON data transmitted from the webserver....
🌐
Reddit
reddit.com › r/tasker › parse json into array
r/tasker on Reddit: Parse JSON into array
January 23, 2021 -

Hi

I'm trying to parse a JSON response to a GET request and store the values of an attribute into an array. The JSON input looks like this:

[ { "created": "2021-01-23 22:30:00", "title": "title1"}, { "created": "2021-01-23 22:30:00", "title": "title2"}, ... ]

And I'd like the array to look something like ["title1", "title2", ...]. I've tried the following JS snippet, but I get undefined:

var data = JSON.parse(local('http_data'));

setLocal("titles", data.map(el => el.title));

%titles give 'undefined'.

Anyone know how to go about this?

🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-get-a-value-from-a-json-array-in-javascript
How to Get a Value from a JSON Array in JavaScript? - GeeksforGeeks
June 28, 2025 - ... let a = [ { "name": "Sourav", ... value of the name property in the first object. The find() method allows you to find an object within a JSON array based on a condition....