public static ParsedJson ParseJson(byte *jsonData, int length, bool reallocIfNeeded = true) { var pj = new ParsedJson(); bool ok = pj.AllocateCapacity((ulong)length); if (ok) { JsonParse(jsonData, (ulong)length, pj, reallocIfNeeded); } else { throw new InvalidOperationException("failure during memory allocation"); } return(pj); }
public static ParsedJson ParseJson(byte *jsonData, ulong length, bool reallocIfNeeded = true) { var pj = new ParsedJson(); bool ok = pj.AllocateCapacity(length); if (ok) { JsonParse(jsonData, length, pj, reallocIfNeeded); } else { pj.isvalid = false; pj.ErrorCode = JsonParseError.CAPACITY; } return(pj); }