Skip to content

Checking if a field has a certain JSON type #652

Open
@Azmisov

Description

@Azmisov

I'd like to parse unstructured JSON. For example, a field that is either a string or []string. As a suggestion, I feel there is the need for IsString, IsArray, etc methods. These would theoretically allow checking the type of an AstNode in a performant way. Currently, I am using two techniques to accomplish this, both of which seem poor:

  1. Call String or Array and check for errors
  2. Call Interface, then use reflection to check the type

If an IsString, etc method would be no more performant than either of these techniques, feel free to ignore my suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions