I have an automation where a json string is made.
This is an example from 1 object in the json string:
[{“id”:“”,“page”:“landing-result-page”,“path”:“”,“title”:“”,“content”:“”,“enabled”:true,“redirect”:null,“settings”:{“intro”:{“text”:“”,“_component”:“mark-down”},“outro”:{“text”:“”,“_component”:“mark-down”},“header”:{“_component”:“results-header”,“background”:{“url”:“”,“_type”:“image”,“width”:300,“height”:0,“shared”:true}},“filters”:[“{"_type":"filter","field":"city","values":"braamt,groenlo,bredevoort,winterswijk,hellendoorn,doesburg,doetinchem,groenlo,lochem,zutphen,borculo,laag-keppel,lichtenvoorde,terborg,zevenaar"}”],“sortOptions”:{“sortField”:“SEQUENCE”,“sortDirection”:“ASC”}},“created_at”:“”,“partner_id”:59,“updated_at”:“”,“description”:“”,“layout_template”:“default”,“content_template”:null,“data_layer_attributes”:}
In the JSON string there are multiple of these objects.
The “filter” part isn’t right in this string.
What it is now:
,“filters”:["{"_type":"filter","field":"area","values":"gelderland"},{"_type":"filter","field":"facility","values":"Zwembad binnen"}"]
What it needs to be:
,“filters”:[{“_type”:“filter”,“field”:“area”,“values”:“gelderland”},{“_type”:“filter”,“field”:“facility”,“values”:“Zwembad binnen”}]
All the \ and the " between [{ and }] needs to be out.
What I tried to do, is make an RegEx for the part “filters”:[“{}”] And with everything that is in between {}. This array is variable.
New value will be the filter without “” and all the .
New value: “filters”:[{$1}]
I am not an expert with regEx, so i will be thankful if you have tips to do this different.
The output of the text parser is still not the desired output I wish to have.
How come and how can I get the desired output?