0

I am totally new to Jquery please forgive my ignorance and i have been looking at lots of example of .each() function which can do this but still i couldn't this working.

I have a file called test.json which look likes this

{
"objects": [
{
  "connectionString": "jdbc:mysql:/",
  "*password": "pla",
  "name": "Insig",
  "id": "DataNt",
  "type": "MySqlDataNode",
  "table": "staging_queries",
  "username": "portal_dev_dba"
},
......
  "type": "S3DataNode"
},
],
"parameters": [
{
  "id": "clusterName",
  "description": "Which region Cluster name to use",
  "type": "String",
  "default": ""
},
{
  "id": "password",
  "description": "Password to use",
  "type": "String",
  "default": ""
}

] }

Note this is in a json file i need to iterate over this file and update the .parameter.id when its == "clusterName" to the real cluster name and when its == "password" the password which need to be present.

How could i get this done using simple jquery and written it to an json file.

kosa
  • 65,990
  • 13
  • 130
  • 167
Krish
  • 390
  • 4
  • 15

1 Answers1

0

jQuery is an overkill for traversing and updating a JSON object. You can use a functional style query library like lodash for this or simply use vanilla Javascript.

If you need to use jQuery refer this stack overflow question.

Ashan
  • 18,898
  • 4
  • 47
  • 67