- Home /
Question by
Bungalow-12 · May 04, 2016 at 06:22 PM ·
httpwebrequest
Serialize JSON with invalid C# names
Hi all I have an existing Rest API I'm trying to use that has JSON like so { header-property1: "yo", header-property2: 42 }
Unfortunately trying to use JsonUtility requires that I name the field on the class the same as the property or key on the JSON side. Sadly C# does not support the -
as a valid character in a name.
Does anyone know how to make this happen?
Comment
Best Answer
Answer by FortisVenaliter · May 04, 2016 at 06:24 PM
Could you do a find-and-replace to convert it to underscore, which C# does support?
Wow that would be super simple... I'm so sad I didn't even fathom changing it... Thanks!