Skip to content

Cloud Code parameter value requires JSON escaping #9508

Open
@mtrezza

Description

@mtrezza

New Issue Checklist

Issue Description

When storing a string \ in Cloud Code:

  • in a parameter of type String, the string is retrieved in Cloud Code as is.
  • in a parameter of type Object or Array the value cannot be saved unless the character is escaped ({ "v": \ } or ["\\"]) so that the string is retrieved in Cloud Code as \.

This is likely due to the JSON stringification of objects and arrays, which is not applied to simple strings. This becomes an issue when modifying values which requires manual transformation from escaped to unescaped and vice-versa. This is prone to user errors due to the special handling that has to be considered.

Steps to reproduce

  1. Create Cloud Code params of types String, Object, Array with values as described above.
  2. Retrieve values in Cloud Code.

Actual Outcome

Values for Object and Array require escaping.

Expected Outcome

Values for Object and Array don't require escaping and any necessary escaping is handled by Parse Server in the background.

Environment

Server

  • Parse Server version: 7.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$20Bounty applies for fixing this issue (Parse Bounty Program)type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions