Skip to content

Escaping Issue & Console Window closes prematurely #547

@GoldenKarpa

Description

@GoldenKarpa

FIRST ISSUE

  1. Version: 5.0.6
  2. v16.13.1

My JSON may contain segments like

' "text": "@AccountName1 \n@accountName2", '

from

        "id": <number>,
        "created_at": <number>,
        "text": "@accountName1 \n@accountName2",
        "owner": { ...

which is from a comment section. I assume the user is including a new line entry which registers as the '\n'. My problem is when I convert to csv, that '\n' causes an error in the output, such that:

Line X ends with ';"@AccountName1 '
Line X+1 starts with '@accountname2";'

Whereas in other areas it outputs as:
Line Y contains ';"@AccountName1 @accountname2";'
which is what I desire.

  1. My command is:
    json2csv -d ; --flatten-objects -i <input> -o <output>

I think in my research, this problem is referred to as an escaping issue? I've tried the -q and -Q commands to no avail. How do I resolve this issue?

SECOND ISSUE

I'm running the json2csv command as part of a batch file that I execute through Windows CMD. However, the json2csv command closes my console window.

  1. json2csv -d ; --flatten-objects -i <input> -o <output>
    ... this would process and output the relevant csv file, but the next command from the batch file never executes.

  2. @for %%d in (%cd%\#Results\*.json) do echo %%d && json2csv -d ; --flatten-objects -i %%d -o %%d.csv
    ... this would process, outputting the relevant csv files until the final step in the loop. The final json file in the target source gets converted to a csv file, but then the next command in my batch file is not run and the console window closes.

I'm not sure what is the cause of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions