How to save the JSON string properly?

Hi there

So, I process the incoming JSON string in the experience workflow and it is seen as the following in the debug node.


Like this

However, if see it in the group tag, it is like the following.

So, if I read the group tag value from the experience page javascript, it returns the string with “&quot”, so I have to process this string once again.
My question is, how to save the JSON string properly into the group tag so that it does not have “&quot”?


I’m assuming you are taking that value from and setting it as a group tag using a Group: Update Node? Most likely the issue is you are referencing the value as {{}} (two braces) vs. {{{}}} (three braces).

The two-brace version will escape any special HTML characters, such as those quotes. The three-brace version will not, which is what you want.

One word of caution about storing JSON strings in tag values: The values support a maximum of 255 characters, so take extra care to be sure any values you are storing in that manner will fit within that limitation.

Hi @Dylan_Schuster
Thank you for your update.

So, as for the maximum length of the tag value, 255 characters is too short for our project.
So I would like to store the customer & device hierarchy in the experience user group tag value.
This hierarchy should be different according to each user group, so I think it is reasonable to store it in the user group tag value.

But, 255 characters is too short to save the hierarchy. So how can I achieve this goal without using the tag value?


What do you mean by the “hierarchy”? Is this different from the parent structure and device association that is natively supported and is retrievable through the workflow engine? If it is different, I’m interested to hear why those two features are not fulfilling your requirement; and if it is not different I’d like to know why it is necessary to store that information in a device tag instead of retrieving it at runtime in a workflow execution?

That said, string values in data table rows store 768 characters, so an alternative would be to put the JSON string in a data table row and associate the group to that row one of two ways: by storing the row ID on the group and looking up that row in a workflow, or the opposite - storing the group ID as a column in that table and retrieving the JSON string that way.

Thank you for your reply.
So, let me explain.

So, we made the hierarchy like the following one.

So, this hierarchy should be modified by the user. The user should be able to create a new customer and asset as he/she needs and assign the devices to any asset of any customer.
So I already implemented the solution for this using the user group tag, but as you know its limit is too short for me.
So, if the number of the customer, asset and the devices is increased, 255 characters is too short to save this hierarchy structure.
Of course, I think I can use multiple tags, but it makes the structure too complicated.

Hope this information will be helpful.
If you have any other solution for this, please let me know.

So how does this model translate to Losant resources? Are “customers” and “assets” Experience Groups? Are they Experience Users?

Customers owns 0 or more assets; can assets be owned by more than one customer?

Devices, I assume map to Losant’s Devices?

You can certainly roll your own hierarchical multitenancy structure through group tags and data tables as I suggested before, but based on what I know so far, what you are doing here fits very well into the model we have built already and have several features to support.

I recommend checking out these Deeper Dive Webinars on Experience Groups and multitenancy models before you get too far into building your solution, in hopes that you don’t make more work for yourself in the long run:

Hi @Dylan_Schuster
Thank you so much for your kind update.

So I have checked the nested experience group, and it does make sense. And then, it looks like it fits to our requirement for now. The problem is that the user should be able to modify the hierarchy as he/she needs on the dashboard. So I think I will need to develop the experience page to do this.
I tried to find the nested experience group application in the example applications, but I can not find it.

So, where can I find this example? Can you please let me know?

Hi @Dylan_Schuster

I have found the example application on Github, I think it is the following one.

Is it right?

That’s a good one to look at, yes.

You could also start a new application from the Industrial Equipment Monitor template, which also demonstrates a multi-tenancy model - but it won’t include any features around editing the tenancy model from the experience side.

Hi @Dylan_Schuster
Thank you for your update.

Okay, I will look into this carefully.