JSON is not steamed, what is the reason?

  • 0
    good afternoon, trying to get objects from JSON but it doesn't work, what is the reason?

    function setJson(responseJson) {
        console.log(responseJson)
        var message = JSON.parse(responseJson)
    
    
        for (var i = 0; i < 2; i++) {
            if (message.type == "send") {
                load_dataSend(message.textm)
            } else {
                load_dataGet(message.textm)
            }
        }
    }


    And here is the JSON itself:
    [{"id": 1, "id_user": 2, "text": "Hello everyone!", "date": "Nov 6, 2020", "type": "send", "status": "read" }, {"id": 2, "id_user": 2, "text": "Goodbye everyone!", "date": "Nov 6, 2020", "type": "get", "status": "new "}]
    JavaScript Anonymous, Oct 13, 2020

  • 1 Answers
  • 0
    It turns out it automatically parses, you can like this responseJson [i] .text
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!