Question

Convert Json to String

Hi,

Are there any pre-installed functions available to convert a Json object to a string? When I try to declare JsonSerializer, it doesn't find it. Wondering if I need to import it or if there is something else I could use.

 

Thanks!

Like 0

Like

5 comments

Hello Heather, if you need serialization in the source code you can just add using Newtonsoft.Json and work with it. 

Hi @Heather! How are you? Do you need in C#? You could use:

    string jsonString = Json.Serialize(response);

Adding this reference: using Terrasoft.Common.Json;

I hope you find it useful

Regards.

Uriel Nusenbaum,

Hi,

When I try to use it on my page, I get the following error.

message: Uncaught Error: Script error for "Terrasoft.Common.Json", needed by: UsrManifests1Page

 

I'm not sure how I'm supposed to add it to the Page. I tried it as follows but I guess this is not correct.

define("UsrManifests1Page", ["ProcessModuleUtilities","ConfigurationGrid", "ConfigurationGridGenerator", "ConfigurationGridUtilities","Terrasoft.Common.Json"], function(ProcessModuleUtilities) {
 

Thanks very much

Dmytro Vovchenko,

Uriel Nusenbaum,

I think my confusion may be that I am trying to read a message from the Sandbox, not real Json. So it is not recognizing it as Json. From the Sandbox documentation, I do not see how I am supposed to access the particular value of my Sandbox message from the args. Do you happen to know how to do this?

 

I have this in the Sandbox which I thought was Json. I need to get value: as a string.

{value: 'undefined; bb49d0ab-62fc-4009-ad35-6ff40bfb0476'}

Uriel Nusenbaum,

Dmytro Vovchenko,

Thank you for your help. I realized I can just get the value from the Sandbox like this. Did not turn out to be Json related but I appreciate your assistance.

onMessageSubscribe: function(args) {
				this.set("selectedDetailRows",args.value);
            },

 

Show all comments