Linux, CS 6.83
With this code and with json mentioned in first line a: () rule is skipped by CS
# :json crm-data {"error" : "rghr", "token" : "sometok_enblyat", "accounts" : [{"token": "anytoken1", "name" : "Westwood"}, {"token": "anytoken2", "name" : "Forestpaper"}] }
u: (\:json _*1 _*)
$$counter = 0
# $orjs = ^original( _1 )
$crmdata = ^jsonparse( ^original( _1 ) )
$tmp = ^jsonpath(.accounts $crmdata)
$tmp = ^length($tmp)
${tcard\: navigation-card\: {"items"\: \[
loop( $tmp )
{
\{"title"\: \" ^jsonpath(.accounts.$$counter.token $crmdata )\" \}
$$counter += 1
if ($$counter < $tmp) { , }
}
\]}$}
a: ( )
$crmdata.error
The next code works as expected (transfer json as usual string)
u: (\:json _*1 _*)
$$counter = 0
$orjs = ^original( _1 )
$$crmdata = ^jsonparse( ^original( _1 ) )
$tmp = ^jsonpath(.accounts $$crmdata)
$tmp = ^length($tmp)
${tcard\: navigation-card\: {"items"\: \[
loop( $tmp )
{
\{"title"\: \" ^jsonpath(.accounts.$$counter.token $$crmdata )\" \}
$$counter += 1
if ($$counter < $tmp) { , }
}
\]}$}
a: ( )
$$crmdata = ^jsonparse( $orjs )
$$crmdata.error