Search Unity

Announcing first-class support for JSON as a Remote Config datatype

Discussion in 'Unity Remote Config' started by markychoi, Apr 7, 2020.

  1. markychoi



    Aug 4, 2014
    We are adding first class support for unstructured JSON as a value type.

    Previously, we heard from many that a typical workaround is to store JSON encoded strings using the string datatype. JSON requires double-quotes around string values, and supports backslash-quoting of certain special characters—including double quotes.

    Unfortunately, by storing JSON encoded strings in the string datatype, you are forced to do additional work to properly escape strings. This is exacerbated by the fact that JSON expects the double quotes as ASCII double quotes (\u0022), which is the JSON string delimiter. Mis-use of the various Unicode “double quotes” characters can lead to unexpected results for the developer.

    The addition of JSON as a supported Remote Config datatype aims to solve these usability issues. We created a new Remote Config datatype JSON, and provide you a method GetJson() to be able to fetch and utilize the JSON at runtime as a string. In conjunction with JSONUtility, you can use this functionality to generate JSON strings from a Component, ScriptableObject, and other objects, and to fully overwrite complex objects using the JSON setting type.

    You get all this and more with the new 1.3.0-preview.1 version of the RC package. Additionally, this package includes the following features:
    • Added UI JSON Window in the Editor for manipulating JSON values
    • Added ability to format and validate JSON within the JSON window
    • Added ability to load JSON from local file
    Sample UI from the Unity Editor

    Loading JSON from a file
    To load JSON from a file, click on the button that is directly to the right of the “Select json object:” input text box. This allows you to load JSON from any files in your /Assets folder:

    Sample UI from the Dashboard
    To create a new setting with type JSON in your Remote Config dashboard, navigate to the “Configs” page, add a new key, select JSON in the “Type” drop-down menu. The dashboard also provides a visual JSON editor for easier editing and validation of your JSON input. Simply click the “<>” icon to open the editor:

    Utilizing JSON at runtime as a string
    Developers now have the ability to overwrite objects by utilizing JSON at runtime. This opens the possibility for a single setting with type JSON to contain all the configuration data for a single Unity object. And the code required to apply JSON settings to your object can be as little as one line.

    For more information and an example, refer to the Utilizing Setting of type Json for overwriting objects in the Remote Config documentation.

    Feedback and Future Plans
    Looking forward, we are exploring other ways to enhance JSON with additional functionality, like custom schema validation. If you have feedback or ideas around JSON features you’d like to see, we definitely would like to hear from you. Feel free to respond in this forum or email us.

    For more information, refer to the latest Remote Config documentation. As always, you can reach us directly with any support questions or needs at
  2. RichLogan


    Aug 11, 2015
    This is great as it has allowed me to migrate my existing configuration (nested Serializable structures with ScribtableObject "instances") to be sourced from Remote Config. I was wondering if there is a plan on the roadmap to display these in the editor and dashboard in a more user-friendly way? I have lots of settings that are in nested config options, and it would be great if a (non-)developer can just come in and tweak one of those nested settings without having to mess with potentially large nested JSON strings.
  3. peterle_unity


    Unity Technologies

    Oct 3, 2017
    Hi RichLogan, thanks for your interest in Remote Config!

    One of our next planned features is called Schema JSON - whereby developers can define a JSON schema that Remote Config settings can be validated against. In this way you could define a rigid framework for your JSON, and then we could validate JSON objects of this type - making that any subsequent new settings or updates much safer, as no breaking change could be made.
    JeffDUnity3D likes this.
  4. Berlm


    Dec 27, 2019
    This is great! My only problem is, I cant see the json option. Do I have to update my unity version so I can get a newer version of remoteconfig?
    What version would I need to upgrade to?
    My current version is: 2019.3.9f1
  5. JeffDUnity3D


    May 2, 2017
    Select Show Preview Packages under the Advanced drop down in Package Manager.
  6. vlater


    Jun 4, 2013
    Does the new JSON field have a limit - 10000 characters as the string field?

    Edit: To answer my own question: Yes, I've just checked - JSON field will accept no more than 10000 characters - the same as the string field. So when using json field with large data, this limit should be considered
    Last edited: Sep 8, 2020