Reputation: 161
Contentful is a very useful service but unfortunately the json response format does not allow for standard expanded json data format.
It requires us to write and extra translator to return common json structure nesting.
For instance, with Contentful we get (simplified version)
{
"module" : {
"lessons" : [
"id": "<lesson_id>"
]
}
"includes": {
"Entry": [
{
id: "<lesson_id>",
lesson : {
"lesson data" : "lesson data",
topics : [
"id" : "<topic_id>"
]
}
},
id: "<topic_id>",
topic : {
"topic data" : "topic data",
]
}
}
]
}
But we want this
{
"module" : {
"lessons" : [
{
"lessonData" : "lesson data",
"topics" : [
{
"topicData" : "topic data",
}
]
}
],
}
}
Anyone have a generalized tool to assemble a Contentful response into a standard json response?
Upvotes: 0
Views: 367
Reputation: 344
Have you used any of our SDKs? They have Include resolution built-in so that you don't have to do this manually.
There are many tools built already with them to, for example, serialize content to YAML (using a format similar to what you describe) so that static site generators can consume from it.
You can read more about this on our developers page: https://www.contentful.com/developers/docs/
Hope this helps
Upvotes: 0