I’m building an app using Knockout. The end result is a JSON that I want to fire back over to the server. But, the data is very complex, and as a result, can grow in size to be a few mb’s.
I’m thinking it might be smart to introduce an “end of file” marker so that if someone closes a browser window or if the upload gets interrupted, I can handle that situation accordingly.
This might seem too general for SO, but what would be the right approach? Just appending a string to the end of the JSON that I look for, server-side?
JSON is either parseable, or it isn’t. If the upload was truncated/cut off, you’d end up with an invalid data structure anyways, so there’s no point in an EOF marker.
e.g.
That’s missing
}}}at the end, so it’s invalid json, and the parser will barf on it. If the parser barfs, you know something didn’t work out.