Struggling to extract the "oid" value from a JSON response using Google script for the first time. The original parsed JSON response is as follows:
{btcs=0.01000000, orders=[{amount=0.10000000, price=2000.00000000, oid=592589, type=1}], plns=0.00440603}
Directly attempting to retrieve the oid resulted in an empty variable. However, when parsing with "orders":
oid = raw_data["orders"];
oid = JSON.stringify(oid)
oid = oid.toString().replace("[", "");
oid = oid.toString().replace("]", "");
The result was:
{"oid":"592589","type":1,"amount":"0.10000000","price":"2000.00000000"},
Even after adding:
oid = oid["oid"];
To the parsed "orders," the oid variable remained empty. Attempting to directly retrieve the oid from parsed "orders" without replacing "[" and "]" also did not populate the oid variable.