1542Re: [json] Sanity Check - New to JSON
- Jun 26, 2010Think of it like C++, that should help you figure out when to use an object and when to use an array. Basically, an array is a set of items that are the same object type.
Object length shouldn't be an array, it should just be an object, most of those things should just be object. If you're programming using an object oriented language, mapping to json should be very straightforward. Arrays or vectors or such should translate into arrays in json, where as object should just be object.
From: the_old_chief <energeticpixels@...>
Sent: Fri, June 25, 2010 5:23:00 PM
Subject: [json] Sanity Check - New to JSON
I am a eLearning Application developer who is working on his first experience with JSON. My application has no active server (php, asp, java, etc) to work with. So my json data must be hand-coded. JSON data is being rendered on the client side within a grid (jqGrid). A 'clicked' row is sending data into respective tabbed type windows for further user analysis. I am needing a quick sanity check of my JSON structure. Am I on the right track?? Or am I barking up the wrong tree?? I have temporarily placed a copy of my data (38cal.json) in the files section of this group.
Here is the premise to the structure.
- root node is smallArms. I have other files that will have roots of bombs, chemical, fuses, etc.
- within smallArms, I have two sub-divisions of bullets and shotgun. (shotgun portion not displayed).
- Bullets are broken down into DODICs - military way of identifying a bullet. There could be several dodics listed under 'bullets'. Such as A415 is still a cartridge for US guard or security use in 38 caliber pistols - no matter who is the maker of the cartridge. But there could be other dodics that are related to 38 caliber bullets (depending on the construction of that munition (jacketed, non-jacketed, training round, etc), which would be listed below this dodic.
- Within that DODIC are the munition particulars such as size, weight, chamber pressure, supply information, pictures, animations, etc.
I have taken a look at the documentation on json.org as to structure. I am still a little lost on when to use a object and when to use an array. I thought I would take a crack at it and allow people to tell me I am way off base or that I am close.
[Non-text portions of this message have been removed]
- << Previous post in topic Next post in topic >>