javascript - How to print json object property values? -


i have json object this:

jsonquery = ​'{     "from": 0,     "size": 200,     "sort": [{         "modified": {             "order": "desc"         }     }],     "query": {         "bool": {             "must": [{                 "term": {                     "collectionid": {                         "value": "abcd"                     }                 }             }, {                 "terms": {                     "container": ["en-us"]                 }             }],             "must_not": [{                 "wildcard": {                     "_type": {                         "value": "@@"                     }                 }             }, {                 "bool": {                     "filter": {                         "exists": {                             "field": "dynamicproperties.mainspec"                         }                     },                     "filter": {                         "exists": {                             "field": "dynamicproperties.extendedspec"                         }                     }                 }             }]         }     } }'; 

i creating javascript object doing

var obj = json.parse(jsonquery); 

i go in chrome console , write obj , hit enter , displays object when try access property of object, keeps saying undefined. example: using obj.size.

you have gremlin on first line (jsonquery = '), try remove , retry.

jsonquery = '{"from":0,"size":200,"sort":[{"modified":{"order":"desc"}}],"query":{"bool":{"must":[{"term":{"collectionid":{"value":"abcd"}}},{"terms":{"container":["en-us"]}}],"must_not":[{"wildcard":{"_type":{"value":"@@"}}},{"bool":{"filter":{"exists":{"field":"dynamicproperties.mainspec"}},"filter":{"exists":{"field":"dynamicproperties.extendedspec"}}}}]}}}';    var obj = json.parse(jsonquery);    console.log(obj.size);


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -