Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Replacing the json value

Hi All,

 

I have a requirement to replace Json fields whic i'm getting from twritejson.

This is my requirement.
1)replace fields”:{“  with “fields”:[{“
2) replace suffix”:” “}, with suffux”:” “}],
Please help.
Labels (2)
5 Replies
Anonymous
Not applicable
Author

@TRF 

{"description":"df link","form_name":"df link","fields":{"field_limit":" ","field_type":"textbox","display_name":"test","default_value":" ","is_mandatory":false,"is_hidden":false,"is_read_only":false,"is_searchable":false,"is_key":false,"help_text":" ","validation_formula":" ","calculation":" ","is_edit_lock_for_admin":true,"prefix":" ","suffix":" "},"helplink":" ","usecustomlink":false,"customlink":" ","parent_form_id":0,"parent_field_id":0,"auto_archive":false,"auto_delete":false,"form_type":"FORM","form_owner":{"id":"212633841","first":"firstname","last":"lastname","isActive":1},"full_text_search":false,"owner_group_id":"0","owner_group_type":null,"tracking_mapping_id":0,"is_security_form":false,"pdfTemplateId":" ","enable_xml_input":false} pls see the above sample data with bold letters. i need to add Square brackets next to curl brackets.

i need to get the sample output like below

{"description":"df link","form_name":"df link","fields":[{"field_limit":" ","field_type":"textbox","display_name":"test","default_value":" ","is_mandatory":false,"is_hidden":false,"is_read_only":false,"is_searchable":false,"is_key":false,"help_text":" ","validation_formula":" ","calculation":" ","is_edit_lock_for_admin":true,"prefix":" ","suffix":" "}],"helplink":" ","usecustomlink":false,"customlink":" ","parent_form_id":0,"parent_field_id":0,"auto_archive":false,"auto_delete":false,"form_type":"FORM","form_owner":{"id":"212633841","first":"firstname","last":"lastname","isActive":1},"full_text_search":false,"owner_group_id":"0","owner_group_type":null,"tracking_mapping_id":0,"is_security_form":false,"pdfTemplateId":" ","enable_xml_input":false}

TRF
Champion II
Champion II

As a quick and dirty solution you can replace what you want in your JSON flow using the appropriate String.replaceAll() method within a tJavaRow component connected after the tWriteJSONField.
For a better solution, share an example of what you have, what you want to have and your tWriteJSONField settings.
Anonymous
Not applicable
Author

{"description":"df link","form_name":"df link","fields":{"field_limit":" ","field_type":"textbox","display_name":"test","default_value":" ","is_mandatory":false,"is_hidden":false,"is_read_only":false,"is_searchable":false,"is_key":false,"help_text":" ","validation_formula":" ","calculation":" ","is_edit_lock_for_admin":true,"prefix":" ","suffix":" "},"helplink":" ","usecustomlink":false,"customlink":" ","parent_form_id":0,"parent_field_id":0,"auto_archive":false,"auto_delete":false,"form_type":"FORM","form_owner":{"id":"212633841","first":"Firstname","last":"LastName","isActive":1},"full_text_search":false,"owner_group_id":"0","owner_group_type":null,"tracking_mapping_id":0,"is_security_form":false,"pdfTemplateId":" ","enable_xml_input":false}

 

pls see the above sample data with bold letters.

 

i need to add Square brackets next to curl brackets

 

i need to get the sample output like below {"description":"df link","form_name":"df link","fields":[{"field_limit":" ","field_type":"textbox","display_name":"test","default_value":" ","is_mandatory":false,"is_hidden":false,"is_read_only":false,"is_searchable":false,"is_key":false,"help_text":" ","validation_formula":" ","calculation":" ","is_edit_lock_for_admin":true,"prefix":" ","suffix":" "}],"helplink":" ","usecustomlink":false,"customlink":" ","parent_form_id":0,"parent_field_id":0,"auto_archive":false,"auto_delete":false,"form_type":"FORM","form_owner":{"id":"212633841","first":"FirstName","last":"LastName","isActive":1},"full_text_search":false,"owner_group_id":"0","owner_group_type":null,"tracking_mapping_id":0,"is_security_form":false,"pdfTemplateId":" ","enable_xml_input":false}

 

TRF
Champion II
Champion II

You should have an array declaration into your JSON flow for the "fileds" group.
Can you share your tWriteJSONField settings?
Anonymous
Not applicable
Author

i will share it soon