We're excited to announce that we're launching the second installment of Dataiku Product Days Register Now

Extra \ character while generating json file

Solved!
Ankur5289
Level 3
Level 3
Extra \ character while generating json file

I am facing an issue where i get an extra "\" character while generating json data format from an existing MSSQL data set. The data that i see in json file is like this:

"poLines":"[{\"itemNumber\":52302486,\"quantity\":7,\"dueDate\":20200621,\"poLineNumber\":0}]",

the prepare recipe with "Nest" function makes this an extra string character. Anyone encountered this issue and please let us know how did you solve this?

0 Kudos
2 Solutions
Ankur5289
Level 3
Level 3
Author

@Alex  Thanks for the response. We are using a custom recipe to create .json files format.

Issue is it is not allowing to change data type to “Array” from a string. This is shown below :

Ankur5289_1-1631128191574.png

 

 

Ankur5289_2-1631128191582.png

 

You see all are highlighted as pink and if we change to array it gets converted back to string. How can we store this as an array here ? if we solve this it would be great

 

 

 

 

 

 

 

 

 

 

View solution in original post

0 Kudos
Ankur5289
Level 3
Level 3
Author

We figured out the solution . Basically we were using settings to maintain strict schema equality and hence it was converting an array to string in the cosmos DB.

We are now using the setting free output schema and now it worked

 

 

View solution in original post

0 Kudos
4 Replies
AlexT
Dataiker
Dataiker

Hi @Ankur5289 ,

Can you provide some details on how you are exporting the the json file? We don't support exporting to .json directly from Export recipe. Perhaps you have a code recipe that does this?

If I have a dataset add a nest in prepare recipe this is my output CSV files using Export to Folder recipe as you can see the json is not escaped. 

Screenshot 2021-09-08 at 19.22.17.png

Screenshot 2021-09-08 at 19.19.24.png

Thanks,

0 Kudos
Ankur5289
Level 3
Level 3
Author

@Alex  Thanks for the response. We are using a custom recipe to create .json files format.

Issue is it is not allowing to change data type to “Array” from a string. This is shown below :

Ankur5289_1-1631128191574.png

 

 

Ankur5289_2-1631128191582.png

 

You see all are highlighted as pink and if we change to array it gets converted back to string. How can we store this as an array here ? if we solve this it would be great

 

 

 

 

 

 

 

 

 

 

View solution in original post

0 Kudos
AlexT
Dataiker
Dataiker

Hi,

I am only able to reproduce even when using json. To be able to make that json an array you can use a forumla recipe contact "[" the existing and  "]". Then DSS will allow selecting the Array time. See below. Let me know if this helps.

Screenshot 2021-09-08 at 20.57.20.png

0 Kudos
Ankur5289
Level 3
Level 3
Author

We figured out the solution . Basically we were using settings to maintain strict schema equality and hence it was converting an array to string in the cosmos DB.

We are now using the setting free output schema and now it worked

 

 

View solution in original post

0 Kudos
A banner prompting to get Dataiku DSS