[Bug]: via GraphQL valid JSON cannot be sent to populate JSON field in collection
Link to the documentation page or resource
https://github.com/strapi/strapi/blob/main/api-tests/plugins/graphql/crud.test.api.js#L29C7-L29C7
Describe the bug
a strapi field of type JSON i.e. attributes: {json_field: {type: 'json'}} cannot be filled through graphql with valid json.
a graphql containing this field reference:
{ data: { json_field: {"testkey": true}}
returns the error Strapi GraphQLError: Syntax Error: Expected Name, found String.
This is a perfectly valid field-content and it's acutally the type of JSON one gets from JSON.Parse (keys have double-quotes like in the JSON definition)
Additional context
No response
Suggested improvements or fixes
GraphQL needs to be able to consume valid JSON with keys wrapped in double-quotes.
Related issue(s)/PR(s)
No response
The current workaround is to use a replace function to remove the double-quotes.
This is the Regex we use to identify keys and remove its double quotes.
.replace(^(")"]+[^\\"]+)":/g, '$1:');
But this is ridiculous as a solution, since we work with valid JSON and GraphQL in other projects is easily able to consume valid JSON
@zwingliernst Seems to me like this is not documentation related but main code base related please put the issue in https://github.com/strapi/strapi/issues
I'm sorry you're having trouble with the GraphQL plugin, @zwingliernst, but as our community member Boegie19 mentioned, this is a product issue, not a documentation issue. So please create the issue in the strapi/strapi repo as requested.
I will now close this documentation issue.