Fill array with data using Load from JSON string.

0 favourites
  • 3 posts
From the Asset Store
An educational game for Fill in the Blanks. An easy to use template for developers to build larger games
  • I have found a weird problem and i was hoping that somebody would be able to help me. The problem is that when i try to load (be it a variable or AJAX) requested data into an array it does not fill an array with data. Though when i simply put the json string into the Load from JSON string it works fine.

    I have been searching around and found one other person with a similar problem to mine but there was no answer to his/her question really.

    dropbox.com/s/fhwxzuliiyvevgm/variable_to_array_problem.capx

    JSON code:

    "{
    ""c2array"":true,
    ""size"":[21,1,4],
    ""data"":[
    [[8,1,0,330]],
    [[10,2,1,110]],
    [[12,3,2,220]],
    [[14,4,1,110]],
    [[16,1,0,330]],
    [[18,2,1,220]],
    [[20,3,1,110]],
    [[22,4,0,330]],
    [[24,1,1,110]],
    [[26,1,0,220]],
    [[28,2,1,110]],
    [[30,2,0,160]],
    [[32,3,0,330]],
    [[34,3,1,180]],
    [[36,4,0,110]],
    [[38,4,1,250]],
    [[40,3,1,110]],
    [[42,2,0,290]],
    [[44,1,1,330]],
    [[46,3,0,110]],
    [[48,2,2,170]]
    ]
    }"

    In the above example i simply put the json line into a variable but i have also tried to use an ajax request (after uploading the json files/compiled project to the server) also without success.

    Its probably some really silly small thing that i am missing.

    Hopefully somebody is able to help me with this.

  • You don't need the extra quotation marks if you're storing it in a variable or in a file.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah thank you always the small little things :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)