Reading JSON structure from .txt file

Hi All,

I was wondering if there was a way, to extract JSON structure present in a text file. through a built-in function or a forge application in OutSystems. So I have this big JSON structure present in a text file, after adding the text file to the resources, I am scratching my head for ways to extract the JSON from this text file. Any help will be deeply appreciated.

Regards,

Shree Nandan Das

Hi do not know if this will help you


You jave the ardojson in forge and you can try use jsondeserialize system action from outsystems.(probably you need to convert the resource before trying to deserailize it)


BR

Solution

Shree Nandan Das wrote:

I was wondering if there was a way, to extract JSON structure present in a text file. through a built-in function or a forge application in OutSystems. So I have this big JSON structure present in a text file, after adding the text file to the resources, I am scratching my head for ways to extract the JSON from this text file. Any help will be deeply appreciated.

For that you need to create a structure in your module and than add JsonDeserialize block with the file contents and a structure. In the Data output parameter of JsonDeserialize you'll have all the json parsed to Outsystems structure.


Solution

Carlos Gonçalves wrote:

Hi do not know if this will help you


You jave the ardojson in forge and you can try use jsondeserialize system action from outsystems.(probably you need to convert the resource before trying to deserailize it)


BR

Hey Carlos,

JSONDeserialize takes in a text file and converts it into an OutSystems object. My JSON structure is present in a text file, still for some reasons OutSystems is unable to read it and I keep getting the 'Text data type required instead of Binary Data' issue.

Regards,

Shree


You might want to use BinaryDataToText function from BinaryData extension to convert Binary Data to Text.

Your code would look like this: BinaryDataToText(Resources.Test_txt.Content)

Shree Nandan Das wrote:

Carlos Gonçalves wrote:

Hi do not know if this will help you


You jave the ardojson in forge and you can try use jsondeserialize system action from outsystems.(probably you need to convert the resource before trying to deserailize it)


BR

Hey Carlos,

JSONDeserialize takes in a text file and converts it into an OutSystems object. My JSON structure is present in a text file, still for some reasons OutSystems is unable to read it and I keep getting the 'Text data type required instead of Binary Data' issue.

Regards,

Shree


Hi like Vitaly Martynenko and i  said you need to convert the binary. You need to go to dependencies >> BinaryData and then BinarytoText action.


Vitaly Martynenko wrote:

You might want to use BinaryDataToText function from BinaryData extension to convert Binary Data to Text.

Your code would look like this: BinaryDataToText(Resources.Test_txt.Content)

Thanks Vitaly, helped a lot. 


Carlos Gonçalves wrote:

Shree Nandan Das wrote:

Carlos Gonçalves wrote:

Hi do not know if this will help you


You jave the ardojson in forge and you can try use jsondeserialize system action from outsystems.(probably you need to convert the resource before trying to deserailize it)


BR

Hey Carlos,

JSONDeserialize takes in a text file and converts it into an OutSystems object. My JSON structure is present in a text file, still for some reasons OutSystems is unable to read it and I keep getting the 'Text data type required instead of Binary Data' issue.

Regards,

Shree


Hi like Vitaly Martynenko and i  said you need to convert the binary. You need to go to dependencies >> BinaryData and then BinarytoText action.


Thanks a bunch Carlos, got the solution.


One good option is present in outsystems to generate structure from json text. Right click on structure under data tab. Then you will find an option "Create structure from json". Paste your json string and you will get the structure.