need to write generator from json object with array of objects

0 favourites
  • 2 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Ajax request is returning me an array and setting it into JSON

    How to take the object itself from JSON, which has an array with objects inside, and extract the value from it by key?

    i want to write generator of shop cards from this data

    for example in this array is 6 items(objects) with their own data

    i need to generate 6 shop cards with this data

    is there any methods in construct or with JavaScript ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ajax request is returning me an array and setting it into JSON

    How to take the object itself from JSON, which has an array with objects inside, and extract the value from it by key?

    i want to write generator of shop cards from this data

    for example in this array is 6 items(objects) with their own data

    i need to generate 6 shop cards with this data

    is there any methods in construct or with JavaScript ?

    The easiest way I've found is to have your json contain a key/value pair where the value is a simple csv. Then, create an array and

    -> MyArray: Split string JSONValue with separator "," (type Number)

    That'll create a basic 1 dim array.

    If you have a pure JSON of the data you could also use MyArray.Load then enter var that contains the json.

    You could do your ajax call, make the value of a key to be the json you want to load, assign that value to a variable and then, load that variable into the array.

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