View Feed
group-icon
Java Developers
Community of Java Developers: Get Java Programming Help from fellow Java Developers across the world.
594 Members
Join this group to post and comment.
Naancy Sheba
Naancy Sheba • Feb 19, 2017

JavaScript and external JSON

{"value":[{"firstname":"naancy","email":"nancy@gmail.com","lastname":"sheeba",
"phone":"9791409681","address":"23,Iam Fine Street","city":"chennai","zip":"620012",
"country":"India"}]}
This is my external Json file.I am using HTML form elements to get the value of Email id if it matches all other values will be automatically filled.Suppose if the user wants to change the value of phone number.How could i update it in external JSON file??
Naancy Sheba
Naancy Sheba • Feb 19, 2017
Is the question is such a difficult one?? I cant get any answers still.
Kaustubh Katdare
Kaustubh Katdare • Feb 20, 2017
@Naancy Sheba - Your question isn't very clear. Do you want to know how to update the remote JSON file? Is the file located on remote server? Or you simply wish to update the data that you've received?
Naancy Sheba
Naancy Sheba • Feb 20, 2017
I just want to update the Json file by using Javascript.
for eg. If the field of Phone number is change I need to call onchage() function to update in json
simplycoder
simplycoder • Mar 5, 2017
I do agree the question is pretty unclear, but anyway would still take a stab at it.
In general, you have such 'things' like a file located at server side.
Javascript(Referring to client side) can only pass a request to the server to manipulate to an extent where it passes the required data, and nothing beyond that.
Beyond this, you would require a sever side language to take care of the replacing logic (You can still use javascript if you have are using Node as your server).
Give us more information on these lines and we can help you out. It would be interesting to see what you have done until now. Lets make this interactive.

-Thanks and Regards
SC
James Malvi
James Malvi • Mar 7, 2017
use onchange method to catch event and based on email address, you can identify the json object, modify it and you have the update json object, now you can convert that to JSON data string. to test your json data you can use JSON Formatter and Validator: Advance JSON Formatter with JSON tools
seth88
seth88 • Aug 29, 2017
Use this tool to test, view, edit, and format your JSON: JSON Formatter. Other useful tool: Javascript obfuscator

Share this content on your social channels -