Anouar Ghali
Anouar Ghali

Reputation: 53

F# List (Seq.toList) to Json

I am pretty new to F# so this might be a dumb question. I am using an Excel data provider to parse an excel and then convert it to JSON, so far I mamaged to get the data from excel to a list (let rows = file.Data |> Seq.toList) However I am not sure on how to get it to generate a JSON that I would later expose as an API.
The list shows in this format:

[Row 1
Approval Date = Jul-25 2017 03:14PM
Assigned Group = XXXXXXXXXXXXX
Assigned User = ZZZZZZ
Available Date = Jul-25 2017 03:14PM
Building = XXXXX
Bundle = Global Common - XXXXXXTZZZZ
Checker Due Date =
City = San Antonio

Row 2
Approval Date = Jul-25 2017 03:14PM
Assigned Group = XXXXXXXXXXXXX
Assigned User = ZZZZZZ
Available Date = Jul-25 2017 03:14PM
Building = XXXXX
Bundle = XXXXXXXXXXXX
Checker Due Date =
City = New York
...]

I just need to generate a JSON from this.
Thanks a million in advance

Upvotes: 1

Views: 417

Answers (1)

Destino
Destino

Reputation: 475

You need a library for it the most comon one as far as I know is https://www.newtonsoft.com/json

Just Reference it on your project then you can call it with.

let json = JsonConvert.SerializeObject obj

Upvotes: 2

Related Questions