Snippets tagged json

  • Stackoverflow API script

    A script that consumes the Stackoverflow API in a dynamic fashion

    6 people like this

    Posted: 12 years ago by Mauricio Scheffer

  • Rename JSON properties

    Rename JSON property names by reconstructing JSON object.

    9 people like this

    Posted: 11 years ago by Dmitry Lobanov

  • Retail with units of measure

    Sample retail domain model, using F# types (records and discriminated unions) with JSON sample data using F# Data type provider.

    2 people like this

    Posted: 10 years ago by Tomas Petricek & Phil Trelford

  • Fast(er) Set creation

    Set creation can be quite slow for large sets (> 15000ish string items). If input sequence to create the set is sorted then some optimizations can be applied. For even larger unordered sets (> 30000ish string items) it can be faster doing an up front sort on the data, and then using the Set creation method as described. 1) Set.union is very fast when the greatest element in one of the sets is less than the smallest element in the other; basically becoming an O(1) operation. And Set.add is faster for smaller sets than larger sets, given O(log2 n) of the add operation. So when we have ordered data, makings lots of smaller sets from the stream and union-ing them together can provide a performance boost. 2) On top of the method described in (1), because all the sets are immutable inputs and outputs, then they can be partitioned off onto Tasks to perform the set creation in parallel. If you are using Newtonsoft's Json.net, then provided is a JsonConverter that can be added to the serializer to use this for Set creation like: serializer.Converters.Add Newtonsoft.fastFSharpSetConverter

    2 people like this

    Posted: 8 years ago by manofstick

  • Datatype generic JSON string <-> type

    A simple example of using datatype generic JSON operations from Infers.Toys.

    4 people like this

    Posted: 7 years ago by Vesa Karvonen

  • Finding nearest airplane to a location

    Given a location as a float tuple (latitude, longitude) it will return the plane closest nearby as a JsonValue using the OpenSky API. For fun also demonstrating some operator overloading with (-->) between two coordinates. I'm new to these functional languages, so please feel free to update the solution with interesting refactortings and whatnot.

    4 people like this

    Posted: 5 years ago by Johan Irvall

  • Convert an object to json, and json to object

    There is a namespace System.Runtime.Serialization.Json To serialize generic object you can do like this...

    3 people like this

    Posted: 3 years ago by Tuomas Hietanen