开发者

Where to start with JSON? (Closed)

I'm trying to get started with JSON. I've set the link to the JSON.js file using a script link, and I've set my objects using JSON, but it returns no results at all when I try to refer to the object. The JSON doesn't seem to be working at all. If anyone could point me in the right direction it'd be appreciated. I've looked all over the internet and haven't found much to he开发者_StackOverflow中文版lp me.

Thanks guys. The JSON website helped me figure it out


Get Firefox, get Firebug, learn to use it to see what javascript is being loaded, and where the errors are.

Oh, and post some code.


Take a look-see at this

http://json.org/

basically you need to understand that json is a way to stream javascript object literals and arrays from a server to the client (and vice-versa). Open up firebug/webkit and in the console try

var obj = JSON.parse('{"test": 1}')

and you will see that obj is an object literal with a test property.

edit -- note that the link I provided mentions that json is a "is a lightweight data-interchange format" -- so its does not need to be javascript specific. But I think in practice you will get the most mileage using json in conjunction with javascript.


Here's a couple of links that might help:

http://secretgeek.net/json_3mins.asp

http://www.hunlock.com/blogs/Mastering_JSON_(_JavaScript_Object_Notation_)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜