I am unable to convert the text file to json file. How do I do it? kindly help me to resolve this issue
Is your input text file contains data in json format ? May I know why you want to convert text file into JSON file ?
JSON is text.
Show us what you have and what you’re trying to do with it.
we have a text input file from which we have to extract few fields and add them to json file. i have extracted the fields but unable to convert or create json file.
Hey @sneha_arbole
Just create a dictionary variable with key value pairs like fields as keys in dictionary and values of it.
After that, just do a json serialise which will do the job…
//Package required - Newtonsoft.Json
JsonConvert.SerializeObject(dict_Fields)
The above gives you a JSON string which can be written in a file or can be used however required.
Thanks
#nK
this is not working for me
we can help more directly once you shared a sample file along with the expected JSON result. Thanks for support
I had assigned the given syntax
JsonConvert.SerializeObject(dict_Fields)
A regex / Dict Approach:
Flow & Variables:
Results:
Find starter help here:
ppr_RegexBox_KeyValueText_ToJson.xaml (8.9 KB)
KeyValueText_ToJson.txt (163 Bytes)
We highly recommend to ensure / or to handle Unique Key issues and entries not matching the the key : value pattern