search

Home  >  Q&A  >  body text

javascript - About modifying the key value of json

For such a business requirement, the background returns a string of json data for displaying information, and can modify the value corresponding to the json key, and then save the modified json data.
Similar to the json viewer, a friend gave me an idea, which is to first determine whether the json data is an array and whether there are sub-elements, and then determine whether it is an object. If there are sub-elements, recursion must be used. . . However, I still don’t know how to do it, so I’d like to ask a master for advice. Please help me solve it.
Attached is a diagram of the json viewer

漂亮男人漂亮男人2701 days ago1112

reply all(1)I'll reply

  • 三叔

    三叔2017-07-05 10:56:54

    Baidu/Google js recursively traverses json A lot

    If you modify a node key, you know the key to be modified, and then save the value. The user enters a new key, assigns the key the value you just saved, and then deletes the original key

    reply
    0
  • Cancelreply