Help us shape the future of Go! Take the 2026 Go Developer Survey

jsoncommentstrip

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: MIT Imports: 2 Imported by: 4

README

go-jsoncommentstrip

Build Status GoDoc

GO library for strip JSON comments from input.

Comment Types

Single Line
{  
  // this is a comment
  "not_a_comment": "// this is not a comment"  
}
Multiple Lines
[
  /* multi
   line
   "comment",
   */
   "value": "this is not comment" /* this is another comment */
]

Escaping in JSON

{
    "test": "\"valid string // /*" // escaped string
}

Line Endings Support

Library normally working with *NIX \n and Windows \r\n line endings.

Commandline Tool

$ go get github.com/RaveNoX/go-jsoncommentstrip/cmd/jsoncommentstrip
$ cat json_with_comments.json | jsoncommentstrip

License

MIT

Documentation

Overview

Package jsoncommentstrip contains functions which strips comments from JSON input.

Supported comment types:

- Single line:

{
  // this is a single line comment
}

- Multiple lines:

{
  /* multiple
   * lines comments
   * works
   */
}

Supported line breaks:

\n    - unix style
\r\n  - windows style

Supported escaping in JSON:

{
    "test": "\"valid string // /*"
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader interface {
	Read(buff []byte) (count int, err error)
}

Reader reader which reads JSON and strips comments from it

func NewReader

func NewReader(input io.Reader) Reader

NewReader creates new Reader instance

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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