use perl JSON module to encode and decode, then generate json string.