JSON array size

0 favourites
  • 5 posts
From the Asset Store
220 Food Sprites in 16x16 pixel size. Perfect for items for a retro style game.
  • Hey,

    I'm again (Here) lost with JSON array size.

    I'm trying to have this :

    Fam1

       1,val1,val2,val3,val4,val5

       2,val1,val2,val3,val4,val5

       3,val1,val2,val3,val4,val5

       4,val1,val2,val3,val4,val5

    Fam2

       1,val1,val2,val3,val4,val5

       2,val1,val2,val3,val4,val5

       3,val1,val2,val3,val4,val5

       4,val1,val2,val3,val4,val5

    Fam3 ...

    (I'm looking for storing objects with differents values sorted by families.)

    So, I'm wondering what's the "size":[x,x,x] value.

    Thanks !

  • I don't really understand your question but if you work with JSON data you can also work with Hash.

    The only differences are:

    • It?s easier to work with
    • You can use a alphanumeric index
    • You don?t need to initialize something

    Hash

    If I understand your question:

    size:[Fam, 4, 5]

  • Indeed I'm not clear. What I'm trying to do is storing all my objects specs into an array for an easier manipulation, and this objects are sorted by families, I don't want multiple arrays (One by family) ... But it looks like I can't get this with the array size.

    I'll have a look to an XML file.

  • You don�t have multiple arrays, you will have an multidemsional array.

    Means you haven 1 Array with multiple arrays for every family. Every family will have some arrays included with the values

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • In XML I've something like this :

    <?xml version="1.0" encoding="utf-8"?>
    <items>
         <famille id="1" nom="famille 1">
              <objet id="1" nom="objet1" prix="100" description="Description objet1" lockMeter="0" lockAchi="0" lockItems="0"></objet>
              <objet id="2" nom="objet2" prix="200" description="Description objet2" lockMeter="100" lockAchi="0" lockItems="0"></objet>
              <objet id="3" nom="objet3" prix="300" description="Description objet3" lockMeter="500" lockAchi="0" lockItems="0"></objet>
              <objet id="4" nom="objet4" prix="400" description="Description objet4" lockMeter="0" lockAchi="0" lockItems="0"></objet>
              <objet id="5" nom="objet5" prix="500" description="Description objet5" lockMeter="1000" lockAchi="0" lockItems="0"></objet>
              <objet id="6" nom="objet6" prix="600" description="Description objet7" lockMeter="0" lockAchi="0" lockItems="0"></objet>
              <objet id="7" nom="objet7" prix="700" description="Description objet8" lockMeter="1200" lockAchi="0" lockItems="0"></objet>
         </famille>
         <famille id="2" nom="famille 2">
              <objet id="1" nom="objet1" prix="100" description="Description objet1" lockMeter="0" lockAchi="0" lockItems="0"></objet>
              <objet id="2" nom="objet2" prix="200" description="Description objet2" lockMeter="100" lockAchi="0" lockItems="0"></objet>
              <objet id="3" nom="objet3" prix="300" description="Description objet3" lockMeter="500" lockAchi="0" lockItems="0"></objet>
              <objet id="4" nom="objet4" prix="400" description="Description objet4" lockMeter="0" lockAchi="0" lockItems="0"></objet>
              <objet id="5" nom="objet5" prix="500" description="Description objet5" lockMeter="1000" lockAchi="0" lockItems="0"></objet>
              <objet id="6" nom="objet6" prix="600" description="Description objet7" lockMeter="0" lockAchi="0" lockItems="0"></objet>
              <objet id="7" nom="objet7" prix="700" description="Description objet8" lockMeter="1200" lockAchi="0" lockItems="0"></objet>
         </famille>
    </items>
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)