Class JsonNodeParser

java.lang.Object
software.amazon.smithy.model.loader.JsonNodeParser

public final class JsonNodeParser extends Object
Parses JSON text into a Node.
  • Method Details

    • parse

      public static Node parse(String filename, String content, boolean allowComments)
      Parses a complete JSON document into a Node.
      Parameters:
      filename - Filename used for source locations.
      content - JSON text to parse.
      allowComments - Whether // line comments are permitted.
      Returns:
      the parsed Node.
      Throws:
      ModelSyntaxException - if the JSON is malformed.
    • parse

      public static Node parse(String filename, Reader reader, boolean allowComments)
      Parses a complete JSON document from a reader into a Node.
      Parameters:
      filename - Filename used for source locations.
      reader - JSON character stream to parse.
      allowComments - Whether // line comments are permitted.
      Returns:
      the parsed Node.
      Throws:
      ModelSyntaxException - if the JSON is malformed.