Weird javascript notation

Swa

Honorary Master
Joined
May 4, 2012
Messages
37,777
Reaction score
11,073
Location
www
Can someone tell me what the following notation is and how would you access it? Specifically the 1630 & 1879. Or would it just be easier to put the source through regex?

{"result": ["15.0 - ETH", "1630", "77315;1879;0", "15381;15483;15500;15455;15494", "0;0;0", "off;off;off;off;off", "69;46;69;33;69;33;69;56;69;37", "eu1.ethermine.org:4444", "9;0;0;0", "387;367;369;351;394", "0;0;0;0;0", "0;0;0;1;8", "0;0;0;0;0", "0;0;0;0;0", "0;0;0;0;0", "1;2;3;5;7", "198;211;237", "0"]}
 
Can someone tell me what the following notation is and how would you access it? Specifically the 1630 & 1879. Or would it just be easier to put the source through regex?

{"result": ["15.0 - ETH", "1630", "77315;1879;0", "15381;15483;15500;15455;15494", "0;0;0", "off;off;off;off;off", "69;46;69;33;69;33;69;56;69;37", "eu1.ethermine.org:4444", "9;0;0;0", "3s7;s67;329;351;394", "0;0;0;0;0", "0;0;0;1;8", "0;0;0;#;0", "0;0;0;0;0", "0;0;0;0;0", "1;2;3;5;7", "128;211;237", "0"]}
Looks like a JSON object.. this should be a good starting point:

 
Last edited:
Can someone tell me what the following notation is and how would you access it? Specifically the 1630 & 1879. Or would it just be easier to put the source through regex?

{"result": ["15.0 - ETH", "1630", "77315;1879;0", "15381;15483;15500;15455;15494", "0;0;0", "off;off;off;off;off", "69;46;69;33;69;33;69;56;69;37", "eu1.ethermine.org:4444", "9;0;0;0", "387;367;369;351;394", "0;0;0;0;0", "0;0;0;1;8", "0;0;0;0;0", "0;0;0;0;0", "0;0;0;0;0", "1;2;3;5;7", "198;211;237", "0"]}
Woohoo. I am rich.

Someone just posted the access token to their ethereum wallet.
 
Looks like a JSON object.. this should be a good starting point:

Thanks. What threw me off is that it's completely standalone without being assigned to a variable and not included in any javascript tags. So I'm at a loss as to how to even access it. Still not sure if it wouldn't be easier to just write a regex expression.

Woohoo. I am rich.

Someone just posted the access token to their ethereum wallet.
:ROFL:
 
It’s an object with a single property “result” which is an array of string.
 
That's the thing, it's not an object but html. Anyway already parsed using regex
data.match( /ETH", "(\d+)", "\d+;(\d+)/ )
 
Regex is overkill. Just assign the object to a variable using JSON.parse and map over the result. Using split(';') where needed.


Then just call the values statically using the index.


Good luck.

+1



Simple Example.

Code:
<script>

var JSONString='{"result": ["15.0 - ETH", "1630", "77315;1879;0", "15381;15483;15500;15455;15494", "0;0;0", "off;off;off;off;off", "69;46;69;33;69;33;69;56;69;37", "eu1.ethermine.org:4444", "9;0;0;0", "387;367;369;351;394", "0;0;0;0;0", "0;0;0;1;8", "0;0;0;0;0", "0;0;0;0;0", "0;0;0;0;0", "1;2;3;5;7", "198;211;237", "0"]}';
var JSONobj = JSON.parse(JSONString);

alert(JSONobj.result[1]); //prints 1630
alert(JSONobj.result[2]); //prints 77315;1879;0 and you can just use split on ";" to seperate them.

</script>



That's the thing, it's not an object but html. Anyway already parsed using regex

Not sure what is meant by this, but technicaly it's neither, just text.
The header provided by the pre-hypertext procsessor will inform the browser with what type of payload is about to be delivered and will parse the content using a paticular method.
There's plenty different content types AKA MIME types.


Normal HTML: text/html
CSV: text/csv
JSON: application/json

I.E Using PHP you can change the default content type "text/html" to JSON like this.
Code:
    header('Content-Type: application/json');

It will be rendered as per the attached.

json.png

instead of just text.

notjson.png
 
+1



Simple Example.

Code:
<script>

var JSONString='{"result": ["15.0 - ETH", "1630", "77315;1879;0", "15381;15483;15500;15455;15494", "0;0;0", "off;off;off;off;off", "69;46;69;33;69;33;69;56;69;37", "eu1.ethermine.org:4444", "9;0;0;0", "387;367;369;351;394", "0;0;0;0;0", "0;0;0;1;8", "0;0;0;0;0", "0;0;0;0;0", "0;0;0;0;0", "1;2;3;5;7", "198;211;237", "0"]}';
var JSONobj = JSON.parse(JSONString);

alert(JSONobj.result[1]); //prints 1630
alert(JSONobj.result[2]); //prints 77315;1879;0 and you can just use split on ";" to seperate them.

</script>





Not sure what is meant by this, but technicaly it's neither, just text.
The header provided by the pre-hypertext procsessor will inform the browser with what type of payload is about to be delivered and will parse the content using a paticular method.
There's plenty different content types AKA MIME types.


Normal HTML: text/html
CSV: text/csv
JSON: application/json

I.E Using PHP you can change the default content type "text/html" to JSON like this.
Code:
    header('Content-Type: application/json');

It will be rendered as per the attached.

View attachment 793887

instead of just text.

View attachment 793889

Over 9000!!!
 
Top
Sign up to the MyBroadband newsletter
X