http://www.perlmonks.org?node_id=882034


in reply to Re^2: JSON Formatted String
in thread JSON Formatted String

Before I pass the string to that function, I want to verify whether the received string is in correct JSON format

I know that I can catch the error in particular function can be caught by using $@ variable

I'm confused. You've just answered your own question.

my $valid = eval { $json->decode($input); 1 };

Replies are listed 'Best First'.
Re^4: JSON Formatted String
by nvivek (Vicar) on Jan 13, 2011 at 06:56 UTC

    Thanks a lot. It is working for me.