handle null and escape string in getJSONFieldValue method