JSON Parse Error with Monday-js-SDK when changing data

I always get the error when I try to change data with the Monday SDK:

"message": "Parse error on \": \" (STRING) at [3, 111]",

Here is the code I used:

const setErrors = await monday.api(`
      mutation {
        change_multiple_column_values(item_id: ${id}, board_id: ${process.env.BOARD_ID}, column_values: \"{ \"pt_errors0\": \"0\ }\") {
          id
        }
      }
    `);

Hello @cartersingle and welcome to the community!

I hope you like it here :muscle:

Would you be able to please try the following?

column_values: "{ \"pt_errors0\": \"0\" }"

I am escaping outer quotes here. I believe that might be the issue. You were also missing a quote after 0\

Please let me know how that goes!

Cheers,
Matias

Thanks for the help @Matias.Monday! But unfortunately I’m still getting the same parse error. Any other ideas?

Hey @Matias.Monday I was able to find the solution in another post that fixed the error I was running into. You can find the answer here. The actual solution was as follows:

column_values: \"{ \\\"pt_errors0\\\": \\\"0\\\" }\"

Thanks for the help!

Hello again @cartersingle,

That is great! Sorry about that! I Missed the fact that you were already escaping outer quotes once and had to escape the second ones. My bad!

I am glad you found the answer :grin:

Cheers,
Matias