input JSON object and string will both work

I've add a try... catch statement for identify input is a JSON object or string. If it is a object then stringify to string.