Skip to content

Cannot assign lvalue to path string of the form '$.l1.l2' #32

Description

@manukmohan

Need: I have a hash of the form { "a" => "b" }. I need to insert a hash into it to look like { "a" => "b", "l1"=> { "l2" => "l2_value" } }

Code (using JSON::Path) :
my $hash = { "a" => "b" }; JSON::Path->new('$.l1.l2')->value($hash) = "l2_value"; print JSON::Create->new()->run($hash);

Expected output: { "a" : "b", "l1": { "l2" : "l2_value" } }

Obtained output: { "a" : "b", "l1": null }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions