Location trouble in GraphQL

I’m trying to update a location via GraphQL - can’t get it to work in the playground - can anyone help me see what I’m missing?

Here is what the documentation says to do:
mutation {
change_multiple_column_values(item_id:11111, board_id:22222, column_values: “{"location3" : {"lat":"29.9772962","lng":"31.1324955","address":"Giza Pyramid Complex"}}”) {
id
}
}

I’m good until after column_values: that is a load of nonsense I don’t know what to keep and what to change. the slashes are just kind of everywhere and I can’t make sense of it. Here is what I’ve been trying to get to work to pass in a string:

mutation {
change_multiple_column_values(item_id:1653243041,board_id:1636890828, column_values: “{“location_1” : “42.564779 -87.97627779999999 13905 75th St, Bristol, WI 53104, USA”}") {
id
}

and to pass in JSON:
mutation {
change_multiple_column_values(item_id: 1653243041, board_id: 1636890828, column_values: “{“location_1” : {“lat”:“42.564779”,“lng”:“87.97627779999999”,“address”:“13905 75th St, Bristol, WI 53104, USA”}}”) {
id
}
}

All of it gives me a parse error or a 500 error. Thanks!

Hi @calebanderson, replying here for others to see as well!

GREAT question-- I think JSON value formatting can be a hard concept for a lot of our newer app developers who may have limited technical experience with this data type. Here is a great Stack Overflow thread to check out that explains a bit more about this concept: java - How should I escape strings in JSON? - Stack Overflow.

The reason why we include the slashes before quotation marks is because of JSON standardization. As such, whenever you send a JSON value (i.e. any column_values that you’re sending), you must escape the quotation marks that you include.

So your column values argument should look like this:

column_values: "{\"location_1\": {\"lat\": 42.564779, \"lng\": 87.97627779999999, \"address\": \“13905 75th St, Bristol, WI 53104, USA\”}}"

Notice how I’m only escaping the quotation marks, and not the values that do not require quotation marks (i.e. any number values).

I do also want to give you a heads up-- if you’re sending these values elsewhere (i.e. not in our Developer’s Playground), you must be sure to format your JSON accordingly. For instance if you’re trying to send values in Postman, you will need to double escape your inner quotation marks (this is where the triple backslashes come into play).

I don’t believe this is what you’re trying to do, so single escapes should be fine. Let me know if I’m wrong though!

Thanks - working like a charm now! Also great reading in stock overflow there!

1 Like

I’m so glad to hear!!

Let us know if you have additional questions or concerns at this time.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.