I was excited when Firebase announced multi-path updates a while back. I have a fairly complex data structure that requires writes to several locations for managing relationships between entities, so multi-path updates came at the perfect time - I didn't have to worry about making several back-to-back writes/updates (and risk having Firebase rate-limit me).
So, I coded everything up, buckled in, and performed a multi-path update (using the Rest API), only to be let down by the following response:
"error" : "Invalid data; couldn't parse JSON object, array, or value. Perhaps you're using invalid characters in your key names."
I looked at the docs to see if I was using invalid characters (.
, $
, #
, [
, ]
, /
) in any key names. I wasn't (other than the forward-slash becuase this was the super new and awesome multi-path update that allowed for such a character in the key).
I quickly opened up the Javascript console in Chrome, ran JSON.parse()
on my string, and it parsed into a valid table, so what's the problem?
My update contained the following:
{
"foo/bar": {
"data": {
"baz": 1
}
},
"foo/bar/data": {
"quu": 2
}
}