Home > Software design >  How to store Markdown in a JSON file
How to store Markdown in a JSON file

Time:03-03

I am working on a Next.js blog and trying to use react-markdown to read Markdown data, but I found that I cant store Markdown in JSON files.

./data/hello.json
{
    "thumbnail" : "https://dummyimage.com/722x402",
    "slug" : "hello",
    "title" : "This is hello",
    "description" : "This is description",
    "category" : "hello",
    "content" : "


     #Hello
     **How are you**

",
    }

CodePudding user response:

Literal new lines are not allowed in the middle of JSON strings. Use \n to represent them instead.

  •  Tags:  
  • json
  • Related