Question

I have a json string. I want to get the values from that string using the field name. Please help me to get this. This is my json string format.

[
    {
        "FLD_ID": 1,
        "FLD_DATE": "17-02-2014 04:57:19 PM"
        "FLD_USER_NAME": "DAFEDA",
        "FLD_USER_EMAIL": "test@gmail.com",
        "FLD_USER_PASS": "test"
    }
]

No correct solution

OTHER TIPS

I'm not really sure what the question is but how about

// assuming str is your JSON string

var obj = JSON.parse(str); // parse the string into an object

var firstObj = obj[0]; // get the first (and only) object out of the array

var fld_id = firstObj.FLD_ID; // you can access properties by name like this

var fld_date = firstObj['FLD_DATE']; // or like this

your JSON was invalid. I fixed it for you.

[{"FLD_ID":1,"FLD_DATE":"17-02-2014 04:57:19 PM", "FLD_USER_NAME":"DAFEDA","FLD_USER_EMAIL":"test@gmail.com","FLD_USER_PASS":"test"}]

here's a working example of how to alert the FLD_ID

<script>
var json = [{"FLD_ID":1,"FLD_DATE":"17-02-2014 04:57:19 PM", "FLD_USER_NAME":"DAFEDA","FLD_USER_EMAIL":"test@gmail.com","FLD_USER_PASS":"test"}];
alert(json[0].FLD_ID);
</script>

By the way, this is an array with 1 JSON object, which is why you must reference the index, 0 in this case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top