Help with JavaScript and JSON 11-17-2019, 06:28 PM
#1
I have a script that uses a api to query a results page. The results are in JSON and i want to ask for a object in JSON, get the data, change the value and use in a http request.
The problem is that i don't know how to change the object value. Here is a snip but it's giving error...
The myObj.items[x].link is something like
http://website.com/wws/info/test123
And i want as a string test123. Both domain and path are random and can be removed.
Thanks
The problem is that i don't know how to change the object value. Here is a snip but it's giving error...
Code:
for (x in myObj.items) {
var str = ""+ myObj.items[x].link +"";
var res = str.replace(""+ myObj.items[x].displayLink +"", "");
var res = str.replace("http://", "");
var res = str.replace("https://", "");
var res = str.replace("/wws/info/", "");
document.write(''+res+'\n');
}The myObj.items[x].link is something like
http://website.com/wws/info/test123
And i want as a string test123. Both domain and path are random and can be removed.
Thanks
(This post was last modified: 11-17-2019, 06:30 PM by hacxx.)

![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)