Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

update json where id = x

uzii answered on March 15, 2023 Popularity 1/10 Helpfulness 8/10

Contents


More Related Answers

  • c# update value in a json file
  • json update pytohn
  • use jq to update json file
  • python json update value by key
  • Updating JSON Columns
  • update data in json using javascript
  • json update pytohn
  • json.net jobject replace value
  • modify JSON values in place with jq
  • python update json file content

  • update json where id = x

    1

    A plain JavaScript solution, assuming jsonObj already contains JSON:

    Loop over it looking for the matching Id, set the corresponding Username, and break from the loop after the matched item has been modified: 

    Here's the same thing wrapped in a function:

     

    Popularity 1/10 Helpfulness 8/10 Language javascript
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Mar 15 2023
    uzii
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.