How to convert JSON file to CSV using EmEditor? [error with JsonToCsv.jsee]

I saved the code you(emeditor) shared for JsonToCsv.jsee and followed your instruction"then select this file from Select... in the Macros menu. Finally, open your data file, and select Run in the Macros menu " but I'm getting this error screenshot

Here's one of the lines in the Json file. {"_id":{"$oid":"504e5fe7313ea25b9b00003f"},"date_joined":{"$date":"2011-12-16T23:17:33.000Z"},"email":"[email protected]","first_name":"","group":"virtela","is_active":true,"is_staff":false,"is_superuser":false,"last_login":{"$date":"2012-11-29T07:40:08.961Z"},"last_name":"","password":"sample","url_logging_enabled":false,"username":"[email protected]"}

The desired outcome could would be converting this in CSV format. i.e. screenshot

please advise.

Thank you.

5

1 Answer

There was one issue in the macro at this answer, and I've already updated this answer. Please copy the macro again. (the 3rd line was updated to include toString()). I've tested your sample JSON file and I was able to use this macro without any issues. The output became:

$oid,$date,email,first_name,group,is_active,is_staff,is_superuser,$date,last_name,password,url_logging_enabled,username
504e5fe7313ea25b9b00003f,2011-12-16T23:17:33.000Z,[email protected],,virtela,true,false,false,2012-11-29T07:40:08.961Z,,sample,false,[email protected]

However, the error message you saw (Syntax error at Line 12) in your screenshot was due to a different reason. You were probably using a very old version of EmEditor. Older versions of EmEditor did not support JSON. Please update EmEditor and make sure you are using the latest version of EmEditor.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like