The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Regarding Data to JSON operator for proper JSON output
I am using readdatabases operator and querying the data.I am getting json data in one column of example set as a result but when i try to again convert data to json it is adding / \ slashes to each value and attribute in json. Can anyone help me how can i eliminate that and get the json data as it is displayed in the exampleset attribute column
0
Answers
this is the expected behaviour. In your case, you already have JSON data. Data to JSON doesn't know that, it handles your JSON attribute as a normal text attribute, and converts it *again* into standard JSON, which has to escape the "s with \.
You could split up your example set: select all attributes but the JSON one into one table, keep the JSON attribute in another, keep a common ID (maybe create it with Generate ID if you don't have one) and join later for example.
Best regards,
Balázs
So you already have JSON data? Why are you using "Data to JSON" then?
I don't understand what you need by "I need the example set in json so how do I split up".
Either you need the JSON, you already have that.
Or you want so split up into different attributes. Use JSON to Data (from the Text Processing extension) for that, or the functionality in the database if that exists. There's also Extract Information where you can use JSONPath to access parts of your document.
Regards,
Balázs
Actually, what I meant is... I am getting whole JSON data in single column in Exampleset. But what I want is the actual JSON structure with JSON data as output. Not the JSON data present in table......
For better understanding I am attaching a picture here, Please do take a look. Below picture is the output of Read database operator which is Exampleset. But What I am expecting is actual JSON structure with JSON format as output.
you can use "Data to Documents" to convert the example set format to a collection of documents, similarly to "Data to JSON".
Use "Nominal to Text" to convert the JSON attribute to a text attribute, and "Data to Documents" will pick it up.
Regards,
Balázs