TI中文支持网
TI专业的中文技术问题搜集分享网站

CC3220SF,Json_app的如何获取数组里键值对的值,如何保自己修改的JSON数据永久保存?

1.Json_app的如何获取数组里键值对的值?

"address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021-3100" },

我该如何获取address里面键值对的值?

2.如何保自己修改的JSON数据永久保存?

Viki Shi:

1、Get value – Gives the the user the ability to retrieve data from the parsed json, by entering the key to the data. Input:

Key – The key specifies which data the user wants to retrieve.
Example: the following json represents John’s car collection.
{"name":"John","age":30,"cars": [{ "name":"Ford", "models":[ "Fiesta", "Focus", "Mustang" ] },{ "name":"BMW", "models":[ "320", "X3", "X5" ] },{ "name":"Fiat", "models":[ "500", "Panda" ] }]}
Inorder to retrieve the “X3” from the above json the user should input : “cars”.[1].“models”.[1]
Inorder to retrieve 30 from the above json the user should input : “age”
以上是获取数值的一个举例,详情请看例程的read me文件:file:///C:/ti/simplelink_cc32xx_sdk_4_30_00_06/examples/rtos/CC3220SF_LAUNCHXL/demos/json_app/README.html

2、你是创建了新的template object文件吗?按照上述readme文件,把文件用uniflash添加进去

Lease:

回复 Viki Shi:

我已经把所由文件的都添进去了。

1.我的目的是修改添加进去的json1.json文件上的数据,并把它永久保存起来。

2.我根据我新建的template object创建一个新的json文件,我如何在一新的模板创建的json文件添加我想要设置新的数据,并永久保存起来?

Viki Shi:

回复 Lease:

你创建并写进文件里以后,不是已经保存下来了吗?要怎么个"永久保存"法?

Lease:

回复 Viki Shi:

我按下CC3220sf的复位按钮发现我原先通过uart口修改的json文件,json文件数据里的内容不是我通过uart口配置的内容,还是我通过uniflash写的json文件内容

Lease:

回复 Viki Shi:

为啥,我蓝牙发送JSON格式的数据时调用JSON_parse函数接口时报错。只要在键值为int32_t报错,布尔型和字符串都没问题啊。我发送的数据格式是对的啊?

赞(0)
未经允许不得转载:TI中文支持网 » CC3220SF,Json_app的如何获取数组里键值对的值,如何保自己修改的JSON数据永久保存?
分享到: 更多 (0)