json

package
v0.0.0-...-5239390 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package json is the JSON parser for ZCL. It parses JSON files and returns implementations of the core ZCL structural interfaces in terms of the JSON data inside.

This is not a generic JSON parser. Instead, it deals with the mapping from the JSON information model to the ZCL information model, using a number of hard-coded structural conventions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(src []byte, filename string) (*zcl.File, zcl.Diagnostics)

Parse attempts to parse the given buffer as JSON and, if successful, returns a zcl.File for the zcl configuration represented by it.

This is not a generic JSON parser. Instead, it deals only with the profile of JSON used to express zcl configuration.

The returned file is valid only if the returned diagnostics returns false from its HasErrors method. If HasErrors returns true, the file represents the subset of data that was able to be parsed, which may be none.

func ParseFile

func ParseFile(filename string) (*zcl.File, zcl.Diagnostics)

ParseFile is a convenience wrapper around Parse that first attempts to load data from the given filename, passing the result to Parse if successful.

If the file cannot be read, an error diagnostic with nil context is returned.

func ParseFileWithHIL

func ParseFileWithHIL(filename string) (*zcl.File, zcl.Diagnostics)

ParseFileWithHIL is like ParseWithHIL but it reads data from a file before parsing it.

func ParseWithHIL

func ParseWithHIL(src []byte, filename string) (*zcl.File, zcl.Diagnostics)

ParseWithHIL is like Parse except the returned file will use the HIL template syntax for expressions in strings, rather than the native zcl template syntax.

This is intended for providing backward compatibility for applications that used to use HCL/HIL and thus had a JSON-based format with HIL interpolations.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL