fsprojects / FSharp.Data

F# Data: Library for Data Access
https://fsprojects.github.io/FSharp.Data
Other
806 stars 288 forks source link

feature/json-control-indentation-spaces #1507

Closed njlr closed 2 months ago

njlr commented 2 months ago

Allow user to control indentation when serializing JSON.

let text = """{"items":[{"id":"Open"},null,{"id":25}],"x":{"y":2},"z":[]}"""
let json = JsonValue.Parse text
json.ToString(indentationSpaces = 3)

An optional argument is used to keep things backward compatible.