Skip to content

how get the "root" json type? #170

Closed

Description

@ljf10000

the "root" json
maybe as { ... }
maybe as [ .... ]

how get the "root" json type?

Activity

  1. stephane-moreau commented on Oct 13, 2020

    @stephane-moreau

    You could either use the Get function that gives you back data and type
    in PR #214 I've added a GuessJSONType function that returns the type of data coming next in the buffer just in case

  2. buger commented on Jul 28, 2026

    @buger
    Owner

    Closing as answered — Get(data) with no keys returns the root value and its ValueType. For example: _, vt, _, _ := jsonparser.Get(data); fmt.Println(vt) prints Object, Array, String, Number, Boolean, or Null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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