http://qs321.pair.com?node_id=1185366


in reply to Replace a string that contains special characters

That's some JSON data that is, with an extra } at the end.

Here's an example of how you can load that JSON data as a Perl data structure, then delete items from it, by name, then re-encode the data structure back into a JSON string. Note it's an array reference of hash references:

use warnings; use strict; use JSON; my $json; { local $/; $json = <DATA>; } my $data = decode_json $json; for my $entry (@$data){ delete $entry->{absoluteLimits}; } $json = encode_json $data; print $json; __DATA__ [{"absoluteLimits":{"conditionalLimits":{"bidirVolume":4096000,"name": +"Home"},"resetPeriod":{"volume":"monthly day 15 00:??"}},"sliceVolume +":5120,"subscriptionDate":"29-09-2016"},{"absoluteLimits":{"condition +alLimits":{"bidirVolume":102400000,"name":"Home"},"resetPeriod":{"vol +ume":"2400 hours"}},"description":"Promotion_tariffbasic:29-09-2016,0 +8-01-2017T10:21","name":"1004","sliceVolume":5120,"subscriptionDate": +"30-09-2016T09:21"}]

Output:

[{"subscriptionDate":"29-09-2016","sliceVolume":5120},{"name":"1004"," +subscriptionDate":"30-09-2016T09:21","sliceVolume":5120,"description" +:"Promotion_tariffbasic:29-09-2016,08-01-2017T10:21"}]