Re: split a huge json file in separate per object files

2017-04-13 Thread Justin Rittenhouse
I haven't actually used the module, but I'd at least take a look at JSON::Path. It's like XPath, but for JSON. I *have* used JSONpath before, just not in Perl. If you're interested in JSONPath, check out http://goessner.net/articles/JsonPath/. On Fri, Mar 10, 2017 at 8:57 AM, Marios lyberak wro

Re: split a huge json file in separate per object files

2017-03-10 Thread Brad Baxter
#!/usr/bin/perl use strict; use warnings; use JSON; # version 2.90 my $hash = from_json( test_json_string() ); for my $key ( keys %$hash ) { my $filename = sprintf "%.06d.json", $key; my $subhash = $hash->{ $key }; open my $fh, '>', $filename or die "Can't open $filename: $!"; pr

split a huge json file in separate per object files

2017-03-10 Thread Marios lyberak
Hello community, i have a json file, with a structure like this: { "106" : { "id54011" : [ { "partno1" : "16690617" }, { "partno2" : "5899180" } ], "parts" : [ "0899180", "16920617" ], "id5