catonthecouchproductions
asked on
Read JSON with out AJAX (jQuery)
I have a JSON object with data and i am trying to take that object and read it without using getJSON. The JSON is already loaded on the page. It is not on the callback of an AJAX call using jQuery.
I have worked with AJAX and jQuery to display JSON after making a call, but not sure how to read it if it is already on the page.
Any ideas? Thanks.
I have worked with AJAX and jQuery to display JSON after making a call, but not sure how to read it if it is already on the page.
Any ideas? Thanks.
ASKER
Could you elaborate a little bit?
My goal is to read the JSON and update the input with the value of the json
$(#input).val(object.DataN ame);
Something along those lines for each of my inputs.
My goal is to read the JSON and update the input with the value of the json
$(#input).val(object.DataN
Something along those lines for each of my inputs.
ASKER
Starting to make a bit more sense, never used that function before, I checked out the simple example here: http://www.w3schools.com/jsref/jsref_eval.asp
>>I have a JSON object with data and i am trying to take that object and read it
Do you have:
a. an ACTUAL object or
b.a json string that you need to convert to json?
If a, then you can use a for-in construct to iterate over the object properties.
If b, then you can use $.parseJSON to convert the json string to an object.
http://api.jquery.com/jQuery.parseJSON/
Do you have:
a. an ACTUAL object or
b.a json string that you need to convert to json?
If a, then you can use a for-in construct to iterate over the object properties.
If b, then you can use $.parseJSON to convert the json string to an object.
http://api.jquery.com/jQuery.parseJSON/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
appreciate it, I am going to go test this out. Thank you for explaining this
http://www.json.org/js.html