please forgive me if this is obvious, but I have some JSON:
ExportString[
<|"Names" -> <|
"Sister" -> "Nina",
"Brothers" -> {<|"Older" -> "John","Younger" -> "Jake"|>},
"somethingElse" -> "answer"|>,
"DOB" -> {<|
"Nina" -> 2001,
"location" -> "Miami"|>,
<|"John" -> 2017,
"location" -> "Hell"|>}|>, "RawJSON"]
(NOTE, I am converting an association to JSON just for the purposes of this post. In reality I am making a URL request and it is returning JSON).
I want to separate the JSON at depth 1. So I want to return an association of "Names" and an Association of "DOB". Is there a function similar to Lookup that works with JSON or some other way to index JSON?
Thank you.
EDIT: Actually, I would like to keep "Names" as JSON.
EDIT (per comments): Here's what i'm looking for structurally: The first output I want is the JSON corresponding to "Names":
out1 =
{
"Names":{
"Sister":"Nina",
"Brothers":[
{
"Older":"John",
"Younger":"Jake"
}
],
"somethingElse":"answer"
}
}
The second output I want is an Association of the values corresponding to "DOB":
out2 =
<|"DOB"->{<|
"Nina" -> 2001,
"location" -> "Miami"|>,
<|"John" -> 2017,
"location" -> "Hell"|>}|>
a
, doesExportString[a["Names"]]
do what you want? $\endgroup$