Page 1 of 1

Strange string export of character '/'

Posted: Fri May 11, 2018 1:08 pm
by Gladyon
Is there a specific reason for the character '/' to be written as "\/"?
It makes the output file quite unreadable, and very hard to manually modify by users (currently a string containing a date is exported as "5\/11\/2018"...).
In order to put it into the context, I am modifying the DateTime import/export in order not to use the Tick as it is mostly unreadable by any human in order to have:

Code: Select all

"Date": "5/11/2018"
Instead of:

Code: Select all

"Date": 
{
    "ticks": 636616346703609218
}

So, I'd like to know if I can safely modify 'ES3JSONWriter.WritePrimitive(string value)' by commenting the line:

Code: Select all

case '/':
Note that all the other 'case' are corresponding to the unused method 'CharacterRequiresEscaping()', which seems to indicate that it is actually safe to comment the line I'd like to comment.



By the way, I know that I have a 6 months old version (which I will soon upgrade so I should stop reporting already fixed bugs) so it's probably already fixed, but just in case, I saw that:

Code: Select all

public class ES3Type_StringArray : ES3ArrayType
{
	public static ES3Type Instance;

	public ES3Type_StringArray() : base(typeof(Quaternion[]), ES3Type_Quaternion.Instance)
	{
		Instance = this;
	}
}
I think that 'Quaternion' should be replaced by 'String'.

Re: Strange string export of character '/'

Posted: Sat May 12, 2018 11:50 am
by Joel
Hi there,

The JSON schema we use requires that forward-slashes are escaped. However, you should be fine to comment it out. Though do note that we cannot provide support for modified code.

With regards to the Quaternion/String bug, this appears to be resolved in the current update, and should indeed be string.

All the best,
Joel