How do I interpret a JSON string of an object ?

Just started using Construct 2? Post your questions here

Post » Tue May 03, 2016 11:51 am

Lets say i have the following JSON string of a simple object.

{"c2":true,"w":{"x":7093.726399997016,"y":204,"w":151,"h":151,"l":8722530541249526,"zi":0,"hX":0.503311276435852,"hY":0.503311276435852},"behs":{"8274350867031877":{"acc":0,"g":0,"dx":400,"dy":0,"lx":7087.059999998659,"ly":204,"lka":0,"t":6879.726399997016,"e":true},"4769858671535691":{"r":10000,"c":6.283185307179586,"t":[]}},"data":{"a":5940657200540929,"f":0,"cas":5,"fs":0,"ar":0,"at":0,"rt":0}}

What do al those tags mean ? What info do they give ?

I looked for a reference doc. Cant find it.

Ty.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue May 03, 2016 12:32 pm

99Instances2Go wrote:Lets say i have the following JSON string of a simple object.


this is the Sprite with bullet behavior?
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Tue May 03, 2016 1:07 pm

Yes Sir !

(you have no idea how impressed that i am that you see that)
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue May 03, 2016 2:03 pm

Don't be...
I do not know the meaning of all tags..and it is not very complicated
{"c2":true,"w":{"x":7093.726399997016,"y":204,"w":151,"h":151,"l":8722530541249526,"zi":0,"hX":0.503311276435852,"hY":0.503311276435852},
"behs":{"8274350867031877":{"acc":0,"g":0,"dx":400,"dy":0,"lx":7087.059999998659,"ly":204,"lka":0,"t":6879.726399997016,"e":true},"4769858671535691":{"r":10000,"c":6.283185307179586,"t":[]}},
"data":{"a":5940657200540929,"f":0,"cas":5,"fs":0,"ar":0,"at":0,"rt":0}}


"x"=X
"y"=Y
"w"=Width
"h"=Height
"l"=?
"zi"= Z Index
"hX"=OriginX
"hY"=OriginX
.....
"behs"=Behavior
"acc"=Acceleration
"g"=Gravity
"dx"=SpeedX
"dy"=SpeedY


........
"data"(Animation)
"f"=Frame
"cas"Animation speed

"rt"=Reapet to
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Tue May 03, 2016 2:40 pm

I wonderd if those data are usefull, but all are accessable in the expressions.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue May 03, 2016 3:18 pm

It gives the entire state of an object. You can look at the plugin's source to see what they are without the abbriviations. It's all abbriviated to save on space and because it's just data that's not meant to be modified.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Tue May 03, 2016 6:37 pm

If its abbreviated do we really need decimals to the 15th digit?
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Tue May 03, 2016 6:52 pm

The names are abbriviations but the values need to be precise. This is to save/load objects and you don't want rounding to occur.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Tue May 03, 2016 8:08 pm

So, they are in fact all accessable expressions, and some expressions are calculated with one of more of those tags?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests