I need to output JSON object, that looks like:
{
"dynamicvaluenumberone":3,
"dynamicvaluenumbertwo":7
}
In something, that looks like:
dynamicvaluenumberone (3), dynamicvaluenumbertwo(7)
I’ve found some articles with static values or parsing JSON with jQuery. I don’t want to use any framework to do this simple task.
Have you tried
JSON.parse?For accessing dynamic keys, you can loop over the keys using
for...in:Update: Depending on the browsers you need to support, the
JSONlibrary is also available here: http://www.json.org/js.html