• Discuss all the things!

    146 Topics
    515 Posts

    Hello @LEE-JONG-GUN!

    So looking into JsonConvert it looks like it actually uses LitJson underneath the hood πŸ€”

    So one option to replicate the old functionality is to use BrainCloud.JsonFx.Json.JsonReader to deserialize into Dictionary<string, object> and then BrainCloud.JsonFx.Json.JsonWriter back into a string before having JObject.Parse() use it. This is basically what the old behaviour was and it would strip out trailing .0 values from JS Numbers.

    SuccessCallback successCallback = (response, cbObject) => { response = JsonWriter.Serialize(JsonReader.Deserialize(response)); // Replicate the old BCComms behaviour DisplayLog(string.Format("Success | {0}", response)); JObject jsonData = JObject.Parse(response); if (jsonData["data"]["response"] != null && jsonData["status"].ToString() == "200") { scoreData = JsonConvert.DeserializeObject<ScoreData>(jsonData["data"]["response"].ToString()); // This should be working now as JsonWriter will strip trailing .0 from doubles // ... } // ... }

    Although you could also just use JsonReader instead of JsonConvert as this should also strip the trailing .0 so you don't have to waste CPU cycles on the serialization/deserialization:

    scoreData = JsonReader.Deserialize<ScoreData>(jsonData["data"]["response"].ToString());

    Alternatively you can also bypass using JObjects and JsonConvert in this situation and make use of our BrainCloud.Common.JsonParser together with JsonReader like so:

    SuccessCallback successCallback = (response, cbObject) => { DisplayLog(string.Format("Success | {0}", response)); if (JsonParser.GetString(response, "data", "response") is string responseData && !string.IsNullOrEmpty(responseData) && JsonParser.GetValue<int>(response, "status") == 200) // JsonParser can grab strings directly without having to do object memory allocations { scoreData = JsonReader.Deserialize<ScoreData>(responseData); // ... } // ... }

    I think JsonParser can be handy for grabbing strings of json objects, json arrays, and values directly without having to do memory allocations πŸ˜ƒ

    Let us know if any of these solutions work for you!

  • Suggestions for improvements, new features, etc.

    41 Topics
    132 Posts

    Hi Francesco, thanks for the suggestion about the folder-level import/export feature. I will have our team review it. FYI, you could script the uploads using the SysPrepareUpload S2S API to avoid doing it manually through the portal.

  • Questions specific to particular APIs, libraries, etc.

    60 Topics
    250 Posts

    Thanks for confirming @peter !

  • General cloud code discussions...

    34 Topics
    143 Posts

    Yes, the link provided in that article is automatically updated. For your reference, here is the actual embedded link behind it:
    https://portalx.braincloudservers.com/dts/cloudcode_dts_files.zip

  • brainCloud's online learning tutorials and examples.

    3 Topics
    3 Posts

    brainCloud developers have just release several playable builds of our famous examples! See our cool features in action. Find them at https://getbraincloud.com/demos for Windows, Mac, online and mobile.

brainCloud 5 is alive!

brainCloud 5 features Portal-X (our next-gen portal), Integrated Forums (you found them), our new Bootcamp training videos, and more!

Join the discussion here!

brainCloud Bootcamp!
brainCloud's new video learning portal is now online! Go check out brainCloud BootCamp!

Need to report a defect?
Use the chat widget from the Design Portal - or send an email to support at getbraincloud.com. Thanks!