How do I Make this kind of JSON

Get help using Construct 2

Post » Tue Oct 25, 2016 3:42 pm

Hello !

I was wondering if anybody could help me out in the making of such a json :

Code: Select all
{
    "c2dictionary": true,
    "data": {
        "type": "position_update",
        "content": {
            "player1":{
                "x":1,
                "y":0.5
            },

            "player2":{
                "x":0,
                "y":0.5
            },
            "player3":{
                "x":1,
                "y":0.7
            }
        }
    }
}


I have been trying to reproduce it without success and can't really change the structure of the script receiving it.
I made a dictionary and sent its content "asjson". I really don't know how to make it more complex to fit the needs :(.
If anybody could help, I would love him forever :)

Cheers !
B
7
Posts: 29
Reputation: 331

Post » Tue Oct 25, 2016 9:05 pm

maybe just 2values inside the same key... is it even possible ?
B
7
Posts: 29
Reputation: 331

Post » Fri Oct 28, 2016 2:46 pm

When I am building complex JSON in C2, I build it in the C2 object that I want to use first, then I output the .asJSON to a TextBox (so I can copy/paste it elsewhere), and only then do I tweak the raw JSON and build programs to build it dynamically.

So make the most complex dictionary object that you can in Construct first and then output it to asJSON, so you can see the schema that Construct uses.

Or better yet, switch to @rexrainbow 's Hash plugin, and then you can use JSON like:
https://www.stormforgedproductions.com/ ... ?op=galaxy or
https://www.stormforgedproductions.com/ ... =structure
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822

Post » Fri Oct 28, 2016 10:01 pm

Hi ! thanks for reply I finaly found how to do it by using the json plug-in, not the one by rexrainbow... but the other one (seemed more understandable to me :) ).
Now I can do more complexe json with ease and grace ;D !
B
7
Posts: 29
Reputation: 331

Post » Fri Oct 28, 2016 10:14 pm

https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822

Post » Sun Oct 30, 2016 7:08 pm

Yup ! this one ! Thanks for retrieving the link !
B
7
Posts: 29
Reputation: 331


Return to How do I....?

Who is online

Users browsing this forum: NN81, TsubaRu and 9 guests