JSON array size

Get help using Construct 2

Post » Thu Sep 19, 2013 8:47 am

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 !Joskin2013-09-19 08:49:17
B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Thu Sep 19, 2013 9:23 am

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

The only differences are:
- Its easier to work with
- You can use a alphanumeric index
- You dont need to initialize something

Hash


If I understand your question:
size:[Fam, 4, 5]
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

Post » Thu Sep 19, 2013 9:26 am

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.
B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Thu Sep 19, 2013 9:31 am

You dont 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
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

Post » Thu Sep 19, 2013 9:38 am

In XML I've something like this :

[CODE]
<?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>
[/CODE]
B
39
S
15
G
5
Posts: 295
Reputation: 6,089


Return to How do I....?

Who is online

Users browsing this forum: dand, mageekm, oosyrag and 28 guests