forcedotcom / SFDX-Data-Move-Utility

SFDMU is a cutting-edge Salesforce data migration tool for seamless org population from other orgs or CSV files. It handles all CRUD operations on multiple related objects in one go.
BSD 3-Clause "New" or "Revised" License
438 stars 73 forks source link

[BUG] SFDMU run with --json generates output JSON with wrong format (not parseable) #784

Closed jorgesolebur closed 6 days ago

jorgesolebur commented 2 months ago

Describe the bug Calling SFDMU run with --json parameter should generate the output in JSON. While trying to store the output in a file for further treatment, the file does not seem to have teh right format. There are special characters at the end of the JSON file which makes it impossible to parse later on

To Reproduce Run SFDMU run command with --json parameter and store the result in a JSON file sf sfdmu run -s csvfile -u targetOrg -p ./scripts/sfdmu/someSfdmuFolder/ --noprompt --json >> ./result.json Open the result.json file and go to the end of the file. It contains special characters which makes it impossible to parse: CleanShot 2024-06-05 at 11 43 02@2x

Expected behavior result.JSON file should be parseable (so no special characters at the end of the file

export.json export.json

Log file 2024-06-05__11_36_43.log

_target.csv file. NA

hknokh commented 2 months ago

Hello, @jorgesolebur

Thank you for reporting a bug. I will take a look at it as soon as possible and let you know of any updates.

Cheers

github-actions[bot] commented 2 months ago

This case has been marked as 'to-be-closed', since it has no activity for the 3 days.
It will be automatically closed in another 3 days of inactivity.

hknokh commented 2 months ago

Hello,

I wanted to let you know that I am still reviewing your case and will inform you as soon as I have any updates. Due to my current time constraints, this process may take longer than usual.

Thank you for your patience and understanding.

Best regards

hknokh2 commented 2 weeks ago

Hello, I investigated this issue, and unfortunately, I can't fix it. The --json flag uses a standard SFDX API method to print to stdout (whether it's the console or a file, as you specified), and it seems that it adds extra symbols at the end of the file. This behavior is outside of my control and appears to be a bug in the CLI. These extra symbols will need to be removed manually from the JSON file after it is created.

hknokh2 commented 2 weeks ago

@mshanemc, can you see this issue? I'm using styledJSON method to print json into stdout.

hknokh2 commented 2 weeks ago

@jorgesolebur If you need an execution log in json format, note that --json flag also produces .log file file in json format.

github-actions[bot] commented 1 week ago

This case has been marked as 'to-be-closed', since it has no activity for the 3 days.
It will be automatically closed in another 3 days of inactivity.

github-actions[bot] commented 6 days ago

This case has been closed, since it has no activity for the last 6 days. Feel free to reopen it, if you need more help.