Skip to main content
  • 10000+ Posts
  • 53,376 Replies
10000+ Posts
JSONTemplater and XQuery with nested for and if statements

I managed to generate a new json from the original one getting the info I need but now I see there's some missing data.Each project group has an id, lat-lon info and an array with data for every project inside the group.I generate a new json with a feature for every project but need to also add a feature for every project group without projects in it.This is what I have:[    let $doc := fme:get-json-attribute("_response_body")    for $i in (1 to jn:size($doc))        let $id := $doc($i)("id")        let $lat := $doc($i)("lat")        let $lon := $doc($i)("lng")        let $proj := $doc($i)("projects")        for $j in (1 to jn:size($proj))            return              {|                {"id" : $id},                {"lat" : $lat},                {"lon" : $lon},                {"proj_name" : $proj($j)("name")}            |}]I've tried to nest

Badge Winners

Show all badges

Community Stats

32,428
Posts
123,226
Replies
40,544
Members