This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

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

Other Parts Discussed in Thread: CC3220SF, UNIFLASH

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

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

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

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

  • 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添加进去
  • 我已经把所由文件的都添进去了。

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

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

  • 你创建并写进文件里以后,不是已经保存下来了吗?要怎么个"永久保存"法?
  • 我按下CC3220sf的复位按钮发现我原先通过uart口修改的json文件,json文件数据里的内容不是我通过uart口配置的内容,还是我通过uniflash写的json文件内容
  • 是的,所以上面说了,要保存,就把你的数据写在文件里,用uniflash添加进去。
    至于程序运行时候通过set value写进去的值,reset后就会丢失,这个例程仅是演示一下json功能,其他的需要用户自行去添加
  • 为啥,我蓝牙发送JSON格式的数据时调用JSON_parse函数接口时报错。只要在键值为int32_t报错,布尔型和字符串都没问题啊。我发送的数据格式是对的啊?