-2

I have a json data with count attribute I want to remove "count":2 data from Json data.

Here is the Json data:

{"count":2,"value":[{"StudentId":"5","RollNo":"12228","StudentName":"Farhan","Attandance":"true"},{"StudentId":"6","RollNo":"443433","StudentName":"Arfan","Attandance":"False"}]}

I want to show like this - how is possible using jQuery?

[{"StudentId":"5","RollNo":"12228","StudentName":"Farhan","Attandance":"true"},{"StudentId":"6","RollNo":"443433","StudentName":"Arfan","Attandance":" False"}]

Here is my Ajax call

$(document).ready(function () {
     $('#btnConvert').click(function () {
         $('#result').append(JSON.stringify(makeJsonFromTable('MyTable')))
         $('#result').show()

            var d = JSON.stringify(makeJsonFromTable('MyTable'));
            var d2 = d.value;

            $.ajax({
                url: "@Url.Action("AddUser")",
                type: "POST",
                data: JSON.stringify(value),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                error: function (response) {
                    alert(response.responseText);
                },
                success: function (response) {
                    alert(response);
                }
            });
        })


    })
3
  • delete your_obj["count"]; Commented Nov 2, 2018 at 11:14
  • can you plz tell me how dear? Commented Nov 2, 2018 at 11:15
  • 1
    @Aliyange553 you don't need us to tell you, you can find answers in many places already: google.co.uk/… Commented Nov 2, 2018 at 11:23

1 Answer 1

3

Access that using data.value; where data is the original object:

var data = {"count":2,"value":[{"StudentId":"5","RollNo":"12228","StudentName":"Farhan","Attandance":"true"},{"StudentId":"6","RollNo":"443433","StudentName":"Arfan","Attandance":"False"}]};
data = data.value;
console.log(data);

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.