CLI Export outputting bad JSON
Expected Behavior
contentful space export --config migration-configs/export-contentModel-layout.json
Will export a clean JSON representing the Model (layout) I want to export using the following config:
{
"spaceId": "",
"environmentId": "master",
"managementToken": "",
"queryEntries": "sys.id=layout",
"skipContentModel": "false",
"skipContent": "true",
"skipRoles": "true",
"skipTags": "true",
"skipWebhooks": "true"
}
Actual Behavior
The output is a mess, here is a snippet
{
"contentTypes": ,
[
{
"sys": {
"space": {
"sys": {
"type": "Link""linkType": ,
"Space""id": ,
"92yop6rduul9"
}
} "id": ,
"snippets""type": ,
"ContentType""createdAt": ,
"2023-02-03T16:31:58.365Z""updatedAt": ,
"2023-03-16T22:13:19.937Z""environment": ,
{
"sys": {
"id": "master""type": ,
"Link""linkType": ,
"Environment"
}
} "publishedVersion": ,
9 "publishedAt": ,
"2023-03-16T22:13:19.937Z""firstPublishedAt": ,
"2023-02-03T16:32:00.085Z""createdBy": ,
{
"sys": {
"type": "Link""linkType": ,
"User""id": ,
"5v7vAL4VgrlYaYWFzopg4e"
}
} "updatedBy": ,
{
"sys": {
"type": "Link""linkType": ,
"User""id": ,
"5ycc1mTy0xRipRZEDU9BUy"
}
} "publishedCounter": ,
5 "version": ,
10 "publishedBy": ,
{
"sys": {
"type": "Link""linkType": ,
"User""id": ,
"5ycc1mTy0xRipRZEDU9BUy"
}
} "urn": ,
"crn:contentful:::content:spaces/92yop6rduul9/environments/master/content_types/snippets"
} "displayField": ,
"name""name": ,
"Snippets""description": ,
"Snippets are reusable blocks of content that can be added to Pages or Layouts.""fields": ,
[
{
"id": "name""name": ,
"Name""type": ,
"Symbol""localized": ,
false "required": ,
false "validations": ,
[] "disabled": ,
false "omitted": ,
false
},
{
"id": "content""name": ,
"Content""type": ,
"RichText""localized": ,
false "required": ,
false "validations": ,
[
{
"enabledNodeTypes": [
"heading-1""heading-2",
"heading-3",
"heading-4",
"heading-5",
"heading-6",
"ordered-list",
"unordered-list",
"hr",
"blockquote",
"embedded-entry-block",
"embedded-asset-block",
"table",
"hyperlink",
"entry-hyperlink",
"asset-hyperlink",
"embedded-entry-inline"
]
},
{
"enabledMarks": [
"bold""italic",
"underline",
"code"
]
}
],
,
"disabled": false "omitted": ,
false
}
]
},
I am expecting to run the command, as I have many times in the past, and to produce a well-structured JSON.
Possible Solution
Steps to Reproduce
- Install Contentful CLI
- Setup Export Config
- Run command
contentful space export --config migration-configs/export-contentModel-layout.json - Check output.
Context
Environment
- Language Version: tried: v18.17.0, v20.16.0, v21.7.3, v22.9.0
- Package Manager Version: v9.6.7, v10.8.1,v10.5.0,v10.8.3
- Browser Version: NA
- Operating System: MAC OS 14.6.1 (Darwin ABSMAC-D049DRXXH3.localdomain 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020 arm64)
- Package Version: 3.3.11
Have experienced exactly the same thing. There appears to be extraneous commas all throughout the *-export.json file.
Hello! Same issue here on Mac Sonoma. I tried with several previous versions of the CLI but same result.
I also have this problem (this is the first few lines of a 20,000,000 line export):
{
"contentTypes":,
[
{"sys":
{"space":
{"sys":
{"type":
"Link" "linkType":,
"Space" "id":,
"xxxxxxxxxx"
}
} "id":,
"resource" "type":,
"ContentType" "createdAt":,
"2021-11-09T18:00:11.040Z" "updatedAt":,
"2022-11-14T15:33:06.034Z" "environment":,
{"sys":
{"id":
"master" "type":,
"Link" "linkType":,
"Environment"
}
} "publishedVersion":,
31 "publishedAt":,
There are properties with no values and it looks like some values are being outputted in the wrong place.
This means that we can't back up Contentful at the moment. And we can't create a new web site based on a previous web site.
Running on Windows 11 with the latest version of the CLI.
Duplicate of https://github.com/contentful/contentful-cli/issues/2760
A recent contentful-cli release of v3.3.12 fixed this issue for us
I'll go ahead and close this issue now that the issue has been resolved, thanks for confirming here @chris-cazaly-coop
(see previous comment https://github.com/contentful/contentful-cli/issues/2761#issuecomment-2377174985)