I am used to using JSON to simply store string values and everything just works. Now I run into situation where I can't use JSON and need to have a set of strings stored in an array buffer. Wondering what the practices are to delimit the strings to handle the edge cases such as:
- If the delimiter is double quotes
"string..."
, what if there are quotes inside the string"str"ing..."
. - If the delimiter is a random sequence of characters such as
--MYDELIMITER--
, there is some chance that it will result in a false match (i.e. some string actually contains that sequence).
The array I am thinking would look like this as JSON:
["123", "foo\"", "bar", "ba\"\"z"]
So I'm confused how to do that without JSON:
"123""foo\"""bar""ba\"\"z"
In reality what I would like to do is separate arbitrary values such as booleans, JSON dates, strings, and numbers in a byte array.