Is it possible to load multiple .json project files into a single JSON object?

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hey there!

    I want to store all of my relevant data like localization, ui position, button sizes for the mobile or pc version in a single JSON object.

    Is there a way how I can parse/load multiple .json project files into a single JSON object?

    For example load english_localization.json & interface_data.json & variables.json into Data (name of JSON object).

    So that I can do things like:

    Data.localization.main_menu.header
    Data.ui.pc.main_menu.header.x
    Data.ui.pc.main_menu.header.y
    Data.ui.pc.main_menu.header.font_size
    

    ...

    OR

    ...

    Data.ui.mobile.main_menu.header.x
    Data.ui.mobile.main_menu.header.y
    Data.ui.mobile.main_menu.header.font_size
    

    More specifically:

    Data.Get(".ui.mobile.main_menu.header.font_size")
    

    So for example a menus header text position could be set to:

    x:

    Data.Get(".ui." & platform & ".main_menu.header.x")
    

    y:

    Data.Get(".ui." & platform & ".main_menu.header.x")
    

    Where platform is either pc or mobile.

    Oh and my other question is: Is that a good practice?

    I imagine it being handy to have every data at one place instead of mixing json and global variables. I want to have a modular interface where I can use the same events with different pc/mobile values instead of having double the event count.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay I will discard this idea and just use different JSON objects.

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