admin管理员组文章数量:1180552
Can anyone show me some complex JSON structure and tutorials where i can excel more on this JSON topic using javascript
. So far i am able to understand JSON, its basic structure and how to parse and alert out properties.
I can search in google or other search engines, but i want links from you expert guys who can lead me to right direction than a BOT which displays result.
Can anyone show me some complex JSON structure and tutorials where i can excel more on this JSON topic using javascript
. So far i am able to understand JSON, its basic structure and how to parse and alert out properties.
Share Improve this question asked May 27, 2011 at 22:40 John CooperJohn Cooper 7,61133 gold badges83 silver badges102 bronze badges 3I can search in google or other search engines, but i want links from you expert guys who can lead me to right direction than a BOT which displays result.
- 4 Search Engines like these will take you in the right direction. :) – Praveen Lobo Commented May 27, 2011 at 22:42
- 7 JSON structure isn't all that complex. You can read about it here: json.org . Your question however is a bit vague. Are you referring to AJAX? Serialization? – onteria_ Commented May 27, 2011 at 22:43
- 1 instead of learning JSON, learn JavaScript in depth. One good tutorial for you in this series... blogs.sitepoint.com/javascript-json-serialization – Thalaivar Commented May 27, 2011 at 22:50
2 Answers
Reset to default 34Basics
- Read everything on json.org, including:
- the code for the standard json2.js,
- and this page explaining the standard JavaScript JSON.* APIs
- (Skip the formal definitions for now, and get back to it regularly)
- Read the corresponding JSON Wikipedia entry
- Read the Mozilla Developer Docs' JavaScript Reference on:
- JSON, the
JSON
object,JSON.parse
andJSON.stringify
- Using native JSON
- JSON, the
- Read blogs and articles:
- Get Started with JSON
- JSON: What is is, how it works, how to use it
- Read slides:
- Replacing XML with JSON
- Advanced JSON
- The JSON saga (Also by Douglas Crockford, creator of JSON and json.org, ECMAScript committee member, and acclaimed writer - see below)
- Even watch some videos
- Get to know ECMAScript/JavaScript better:
- Crockford's essays on JavaScript
- the ECMAScript ECMA-262 standard, 5th edition
- Crockford's book JavaScript: the Good Parts
- Browse StackOverflow:
- questions on JSON
- questions on Advanced JSON
- and also questions on Advanced JavaScript to polish your skills
Get (a lot) more involved...
Check out JSON processors and libraries
If you have some knowledge of other languages, you could look at some JSON processors' implementations and get to know what makes them better or worse than their competitors, read their code, etc...
For instance, for Java:
- json-lib
- Jackson
- google-gson
- FlexJSON
For other languages: see json.org (at the bottom of the page) for tons of links.
Learn about JSON variants and JSON-based concepts
- JSONP Wikipedia Entry
- BSON Wikipedia Entry
- ...
Experiment with some JSON endpoints
Look online for webservices exposing JSON-enabled endpoints to play with them. Head over to ProgrammableWeb for that, or use any search engine.
For experimenting, use either:
- Google Chrome and open the Chrome Dev Tools (CTRL+SHIFT+J),
- Firefox and install and open Firebug (F12),
- Internet Explorer and open the Debug Tools (F12) (or install Firebug Lite),
- Alternatively:
- Google Code Playground to play with some of their services (specifically, try that example for an easy JSONP demo with jQuery),
- jsFiddle lets you experiment with libraries and share snippets.
Actually you could very much just use your javascript console to experiment without any end-point and test whether you manage to create objects.
JSON has following types of elements:
- objects (eg.
{}
or{ something: 'somevalue' }
, JSON itself), - arrays (eg.
[]
or[1, 'test', false, true, false, 1, 22, 33]
), - boolean (
true
orfalse
), - integers (eg.
0
,10
,-23342
), - floats (eg.
0.2
,3.1415
,-321312.01
), null
,
So to construct some complicated JSON you can just combine all of the above and assign it to some variable:
var myjson = {
myame: 'Tadeck',
myinterests: [
'programming',
'games',
'artificial intelligence',
'business models'
],
mydata: {
'age': 'not your business',
'something': 'das',
'friends': [
'A',
'B',
'C'
]
},
facebook_friends_count: 0,
iq: 74.5,
answered_your_question: true,
answer_sufficient: null,
question_can_be_answered_better: false,
solutions: [
'read about JSON',
'test JSON in JavaScript',
'maybe test JSON in different languages',
'learn how to encode some special characters in JSON'
]
}
Then play with it in JavaScript and remember that this is the way objects are noted in JavaScript. This is simple, yet very powerful solution (used eg. by Twitter).
If this will not help (btw. again: visit JSON.org), I have one more advice for you: practice.
本文标签: javascriptComplex JSON and TutorialsStack Overflow
版权声明:本文标题:javascript - Complex JSON and Tutorials - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738162772a2066681.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论