Squidex CLI produces invalid json files

I have…

  • [x] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

When I follow the documentation and run this command

sq content export some-entity --format=JSON

The output is a .json file with invalid data format. The records, instead of being exported as a valid json array, are individual objects separated by a rather bizzare ------ separator.

Expected behavior

When I run the command it should export the content into a valid json file

Minimal reproduction of the problem

See above


  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: [VERSION]


  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge


Should you need to validate the json file: https://jsonformatter.curiousconcept.com/

there is more - the command output file does not include any of the default system fields such as ID, version etc, even if we specify them with the --fields flag.

Both things are by design. You could argue that the format-name is misleading and I would agree with that. The reason why it is in this way is that it is easier to import.

Many JSON libraries read the JSON stream and either convert it to a list of objects or, even worse, to a json document and then to a list of objects. If you have a lot of content items, you have to keep all of them in memory, which is obviously, not working in all cases. Therefore the separator.

Thanks for replying.

I do admit that producing invalid JSON is not necessarily something we as a client would expect. I would advise that you add a flag to the command to make the output JSON compliant. Would you consider such feature request?

As for parsing JSON files - to be fair I dont think the implementation is relevant here. I accept the fact that your library may deal with huge json files better using these separators but there are ways to read JSON files as streams in Java as well as in any sensible language.

Totally understand you. I will provide a fix.

Btw: Have you seen the ‘-array’ flag. This should provide the expected result.

You are very welcome to make the CLI arguments better and to provide a PR for that, but the feature is there.

Edit: I improved the arguments a little bit.

I didnt! I could swear i’ve looked at all the params! if it was there all along then i apologise and appreciate you looking into that

1 Like