decodes json string to extract the in and out