如何处理json数据?

时间:2019-02-07 19:06:13

标签: javascript json

Ajax响应是json,如下所示:

{"result":{"callback_url":"","censored_compile_message":"","codechecker_hash":"run-rAxSNGGU02CqbucqeCAB","compile_command":"g++-8 -g -Wno-unused-result -Wreturn-type -Wmain -Werror=return-type -Werror=main -pipe -O2 -std=c++11 `pkg-config --cflags jsoncpp` -I solution.cc -o solution  -lm -lpthread `pkg-config --libs jsoncpp` 1> compile.err 2>&1","compilemessage":"","error_code":0,"hash":"1549566142-445593899","loopback":null,"memory":[8515584],"message":["Success"],"response_s3_path":"2019_02_07_19\/at5ymqu7TXREgZpNJHc8Ad03Bh1FKYbMQfrVPnlIzWC9vSoGD25c5c80bee2b9f9.04362197","result":0,"run_command":"","server":"ip-10-10-91-129","signal":[0],"stderr":[false],"stdout":["Hello Wold!\n"],"time":[0.00231]}}

以上json对象针对以下内容显示:console.log(response)。现在,我想像“ console.log(response.result)”一样访问“结果”,但是它产生未定义的结果。任何想法?

0 个答案:

没有答案