There is currently no good mechanism in Catmandu to adress JSON properties with empty keys. Examples:
example 1
{ "": "empty"}
example 2
{
"x": {
"": "empty"
}
}
For both examples removing, changing or adding information to path containing empty keys results in null operations or bugs.
E.g.
$ echo '{ "": "empty"}' | catmandu convert JSON --fix "remove_field('',)"
Use of uninitialized value $key in string eq at /Users/hochsten/.plenv/versions/5.24.0/lib/perl5/site_perl/5.24.0/Catmandu/Path/simple.pm line 401.
Use of uninitialized value $key in string eq at /Users/hochsten/.plenv/versions/5.24.0/lib/perl5/site_perl/5.24.0/Catmandu/Path/simple.pm line 401.
Use of uninitialized value $key in string eq at /Users/hochsten/.plenv/versions/5.24.0/lib/perl5/site_perl/5.24.0/Catmandu/Path/simple.pm line 401.
[{"":"empty"}]
$ echo '{ "": "empty"}' | catmandu convert JSON --fix "move_field('','y')"
Use of uninitialized value $key in string eq at /Users/hochsten/.plenv/versions/5.24.0/lib/perl5/site_perl/5.24.0/Catmandu/Path/simple.pm line 401.
Use of uninitialized value $key in string eq at /Users/hochsten/.plenv/versions/5.24.0/lib/perl5/site_perl/5.24.0/Catmandu/Path/simple.pm line 401.
Use of uninitialized value $key in string eq at /Users/hochsten/.plenv/versions/5.24.0/lib/perl5/site_perl/5.24.0/Catmandu/Path/simple.pm line 401.
[{"y":{"":"empty"},"":"empty"}]
echo '{ "": "empty"}' | catmandu convert JSON --fix "upcase('')"
[{"":"empty"}]
There is also no way to generate using the basic Catmandu fixes data which contain empty fields.
There is currently no good mechanism in Catmandu to adress JSON properties with empty keys. Examples:
example 1
example 2
For both examples removing, changing or adding information to path containing empty keys results in null operations or bugs.
E.g.
There is also no way to generate using the basic Catmandu fixes data which contain empty fields.
See also: https://github.com/LibreCat/Catmandu/pull/397