Skip to content

Support loading data from JsonValue for JsonProvider. #1309

@voroninp

Description

@voroninp

JsonProvider supports loading data from uri, stream, and stream reader, but not JsonValue which is inconvenient.

Now I had to use it like this:

use ms = new MemoryStream()
use w = new StreamWriter(ms, leaveOpen=false)
value.WriteTo(w, JsonSaveOptions.DisableFormatting)
w.Flush()
ms.Seek(0L, SeekOrigin.Begin) |> ignore
let record = DayCloseData.Load(ms)

Instead of just let record = = DayCloseData.Load(value)


If you a curious why I need this, I can explain.

Some services return such payload:

{
    "history": {
        "2020-01-10": {
            ...
        },
        "2020-01-11": {
            ...
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions