public static JsonObjectType GetType(ref ReadOnlySpan <char> content) { JsonTokenType tokenType = JsonToken.GetType(content); switch (tokenType) { case JsonTokenType.ArrayStart: return(JsonObjectType.Array); case JsonTokenType.ObjectStart: return(JsonObjectType.Object); case JsonTokenType.NameBoundary: return(JsonObjectType.String); case JsonTokenType.Unknown: if (PrimitiveParser.IsPrimitive(content)) { return(JsonObjectType.Primitive); } break; } throw new InvalidOperationException("Unsupported token type."); }