How do I get data from json ?

  • hii everyone ..

    i am working on quiz game and i wants to load data from json file and save different value of different key

    to diffrent variables

    like

    { "subCat" : "Marvel",

    "Questions": {

    "Question1": {

    FIRST QUESTION HERE

    }

    "QUESTION 2":{

    SECOND QUESTION HERE

    }

    AND SO ON..

    }

    };

    { "subCat" : "Movies",

    "Questions": {

    "Question1": {

    FIRST QUESTION HERE

    }

    "QUESTION 2":{

    SECOND QUESTION HERE

    }

    AND SO ON..

    }

    };

    { "subCat" : "DC",

    "Questions": {

    "Question1": {

    FIRST QUESTION HERE

    }

    "QUESTION 2":{

    SECOND QUESTION HERE

    }

    AND SO ON..

    }

    };

    as above example i wants to save subCat KEY to => variable1 and all the data of Questions KEY to => variable2 and for each KEY of subCat to different variables like

    marvel to subCatVariable1 & questions of subCat to Questionsvariable 1

    movies to subCatVariable2 & questions of subCat to Questionsvariable 2

    DC to subCatVariable3 & questions of subCat to Questionsvariable 3

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yes i already but Don't no much how effectively use with construct thats why i not geting desired output what i want

  • I'am like you. I want to make a quiz game and people advice me to use json.

    But I don't find tutorial about how using json. Strange because everybody seems to know json and how use it.

  • you can see this tutorial for help it will must help you.

    youtube.com/playlist

    READ json plugin very care fully you will Get what you are looking for ..

    BTW for which platform?

  • There is a demo project in C3, on the Start Page search for "JSON".

    editor.construct.net

    If you still can't work it out, you should ask more detailed questions and post your code or the project file.

  • u can also do that with an xml file i think (for the quiz game), not necessarily a json file.

    c3 xml example

    xml and xpath is much easier to understand, more like html5 language.

    both json and xml example uses the same thing ajax + xml or json plugin to grab data from files, is just a matter on grabbing the language u prefer xpath or javascript

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