0

I have a Json below which I am experiencing parse issues. I am not able to write sub array elements inside one array element. Need your help



    {
      "fulfillmentMessage": [{
        "text": {
          "text": [
            "Element 1",
            "Element 2",
            "additionalCategory": [{
                "link": "",
                "followup_text": "Yes",
                "title": "Yes"
              },
              {
                "title": "No",
                "followup_text": "No",
                "link": ""
              }
            ]
          ]
        }
      }]
    }



For the above JSON, I am getting the below error

Error: Expecting Comma or ], not colon
3
  • Can you please elaborate? What issue you are facing and what you want to achieve? You can share your tried code too. Thanks. Commented Jul 24, 2020 at 12:36
  • Hi @VivekJain, I have updated my json with the error which I am getting while I am formatting it. Hope it is clear now Commented Jul 24, 2020 at 12:54
  • find the edited answer. Commented Jul 24, 2020 at 13:03

1 Answer 1

1

You missed the curly braces before "additionalCategory". Try this.

var json = {
  "fulfillmentMessage": [{
    "text": {
      "text": [
        "Element 1",
        "Element 2",
        {
          "additionalCategory": [{
              "link": "",
              "followup_text": "Yes",
              "title": "Yes"
            },
            {
              "title": "No",
              "followup_text": "No",
              "link": ""
            }
          ]
        }
      ]
    }
  }]
};
console.log(json);

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Vivek. Its working now. Thanks for your swift help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.