public FullDataSet <ItemDescriptor> Parse(string content, int version) { if (_alternateParser == null) { return(ParseJson(content, version)); } else { if (content.Trim().StartsWith("{")) { try { return(ParseJson(content, version)); } catch (Exception) { // we failed to parse it as JSON, so we'll just see if the alternate parser can do it } } // The alternate parser should produce the most basic .NET data structure that can represent // the file content, using types like Dictionary and String. We then convert this into a // JSON tree so we can use the JSON deserializer; this is inefficient, but it lets us reuse // our existing data model deserialization logic. var o = _alternateParser(content); var r = JReader.FromAdapter(ReaderAdapters.FromSimpleTypes(o, allowTypeCoercion: true)); return(ParseJson(ref r, version)); } }