New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

UnquotedJson

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

UnquotedJson

A JSON parser.

Source
nugetNuGet
Version
1.1.0
Version published
Maintainers
1
Created
Source

UnquotedJson

UnquotedJson is a JSON5 parser.

Objects

  • Object keys may be an ECMAScript 5.1.
  • Objects may have a single trailing comma.

Arrays

  • Arrays may have a single trailing comma.

Comments

  • Single and multi-line comments are allowed.

White Space

  • Additional white space characters are allowed.

Format Convert

unquoted format convert to normal json format:

let x = """{
    0:{index:0, license:t, nameSID:n, image:"img:left", descriptionSID:t, category:r}
    }"""
let y = 
    x
    |> Json.parse
    |> Json.print

UnquotedJson is a superset of JSON, so the JSON.parse parsing function can directly parse normal JSON. follows code convert the normal format to unquoted json format:

let n = """{
    "0":{"index":0,"license":"t","nameSID":"n","image":"img:left","descriptionSID":"t","category":"r"}
    }"""

let y = 
    n
    |> Json.parse
    |> Json.print

Object Serialization

You can define serialization and deserialization functions for objects.

let serialize<'t> obj =
    obj
    |> Json.read<'t>
    |> Json.print

let deserialize<'t> text =
    text
    |> Json.parse 
    |> Json.write<'t>

Here are some examples of serialization of common object types.

Tuple

(1,"x")
[1,"x"]

Array, list, Set and so on

[1;2;3]
[1,2,3]

Record

Supports serialization of anonymous records also.

{ name = "abcdefg"; age = 18 }
{"name":"abcdefg","age":18}

Map

Map [1,"1";2,"2"]
[[1,"1"],[2,"2"]]

Option

[Some 1;None]
[[1],[]]

Union

type UionExample =
| Zero
| OnlyOne of int
| Pair of int * string

[Zero;OnlyOne 1;Pair(2,"b")]
["Zero";["OnlyOne", 1];["Pair",2,"b"]]

Provide tryRead and tryWrite to custom your convert rule

The signature of tryRead is:

tryRead:Type -> obj -> ((Type -> obj -> Json) -> Json) option

The signature of tryWrite is:

tryWrite:Type -> Json -> ((Type -> Json -> obj) -> obj) option

The usage see also FSharpConverter.fs The return value of JSON.parse is Json type that is a Discriminated Union type of F#.

RFC Json

Parse RFC-compliant JSON with extreme parsing speed and minimal memory usage.

  • Case-insensitive
  • Capable of parsing infinity
  • Swallows unquoted data as Json.String
let i = "[\"start\", {\"action\": \"process\", \"data\": [1, 2, 3]}, \"end\"]"
let e = Json.Array
    [ Json.String "start"
    Json.Object
        [ "action", Json.String "process"
            "data", Json.Array [ Json.Number 1.0; Json.Number 2.0; Json.Number 3.0 ] ]
    Json.String "end" ]
let y = RfcJson.parse i
Should.equal e y

UrlQuery

UnquotedJson can be used for query strings in URLs. When the field is of primitive type, the query string format is used. When the field is a complex type, use the Unqoted Json format.

The source see UrlQuery

The usage see also UrlQueryTest.fs

API

The main structure types are defined as follows:

  • The type Json see to Json.

  • The type JsonToken see to JsonToken.

Keywords

unquoted

FAQs

Package last updated on 03 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts