I’m receiving some JSON that looks something like this:
{
"result": {
"customer": {
"@username": "peter"
}
}
}
I then want to show the username on a page, doing this:
$("#result").html(data.result.customer.@username);
This, however, doesn’t work, as @ is an invalid character. Is there any way to go around this without changing the JSON?
data.result.customer["@username"]should provide the result you want.