Extra \ character while generating json file

Ankur5289
Ankur5289 Partner, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts, Registered Posts: 27 Partner

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?

Best Answers

  • Ankur5289
    Ankur5289 Partner, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts, Registered Posts: 27 Partner
    Answer ✓

    @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

  • Ankur5289
    Ankur5289 Partner, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts, Registered Posts: 27 Partner
    Answer ✓

    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

Answers

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,212 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,

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,212 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

Setup Info
    Tags
      Help me…