How to substitute . with _ in key names? (replacing common propertynames )

 https://try.jsonata.org/uZgm69Bfy
https://try.jsonata.org/WsfsFGhjE


https://try.jsonata.org/r2GrHYYou
differnec between 2 menthods

(
$dotsToUnderscores := function($obj) {
$each($obj, function($v, $k) {
{ $replace($k, '.', '_'): $type($v) = 'object' ? $dotsToUnderscores($v) : $v}
}) ~> $merge()
};
$dotsToUnderscores($)
)

(
$dotsToUnderscores :=
$each(?, function($v, $k) {
{ $replace($k, '.', '_'): $type($v) = 'object' ? $dotsToUnderscores($v) : $v}
}) ~> $merge;
$dotsToUnderscores($)
)










No comments:

Post a Comment

calling outside object property or parent

 https://try.jsonata.org/dxPC5s-zM { "list1" : [ { "b" : 1 , "list2" : [ { ...