in reply to perl-json format

It seems that @my_A contains a string which is already JSON-encoded. Passing it to encode_json double-encodes it, ie escapes all quotes with backslashes.

If that is the case, you can produce your desired result through a simple text operation, like

my $json_output = '{"JSON1:[" . join(',', @my_A) .']}';

of you have to decode the existing JSON string before inserting it into a data structure that you pass to encode_json.

Replies are listed 'Best First'.
Re^2: perl-json format
by divyaP (Initiate) on Apr 18, 2012 at 06:53 UTC
    Thanks for all the replies. Yes, @my_A is a JSON string itself constructed with the mysql rows results and my $json_output=encode_json( { JSON1=> \@my_A } ); is encoding again and hence the issue of extra \ and ".