Loading ...
Sorry, an error occurred while loading the content.

Sanity Check - New to JSON

Expand Messages
  • the_old_chief
    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
    Message 1 of 4 , Jun 25, 2010
    • 0 Attachment
      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.

      respectfully,
      Tony
    • jonathan wallace
      Think 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
      Message 2 of 4 , Jun 26, 2010
      • 0 Attachment
        Think 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@...>
        To: json@yahoogroups.com
        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.

        respectfully,
        Tony







        [Non-text portions of this message have been removed]
      • John Cowan
        ... That s overly restrictive for JSON, whose aggregates are modeled on JavaScript. An array can be seen either as a sequence of data items (same type or
        Message 3 of 4 , Jun 26, 2010
        • 0 Attachment
          jonathan wallace scripsit:

          > Think 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.

          That's overly restrictive for JSON, whose aggregates are modeled on
          JavaScript. An array can be seen either as a sequence of data items
          (same type or different types, it makes no difference) or as an object
          (key-value mapping) where the keys are integers from 0 to n - 1.

          --
          Winter: MIT, John Cowan
          Keio, INRIA, cowan@...
          Issue lots of Drafts. http://www.ccil.org/~cowan
          So much more to understand!
          Might simplicity return? (A "tanka", or extended haiku)
        • jonathan wallace
          I didn t say it was like C++, I just recommended visualizing it that way to help simplify the json that the user had posted. There were many places where
          Message 4 of 4 , Jun 26, 2010
          • 0 Attachment
            I didn't say it was like C++, I just recommended visualizing it that way to help simplify the json that the user had posted. There were many places where objects should have been used instead of arrays. Yes, arrays in json are more like a JS array or a multimap.




            ________________________________
            From: John Cowan <cowan@...>
            To: json@yahoogroups.com
            Sent: Sat, June 26, 2010 1:26:53 PM
            Subject: Re: [json] Sanity Check - New to JSON


            jonathan wallace scripsit:

            > Think 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.

            That's overly restrictive for JSON, whose aggregates are modeled on
            JavaScript. An array can be seen either as a sequence of data items
            (same type or different types, it makes no difference) or as an object
            (key-value mapping) where the keys are integers from 0 to n - 1.

            --
            Winter: MIT, John Cowan
            Keio, INRIA, cowan@...
            Issue lots of Drafts. http://www.ccil.org/~cowan
            So much more to understand!
            Might simplicity return? (A "tanka", or extended haiku)






            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.