HALJSonDeserializer by Mamadou Samba DIALLO

<PackageReference Include="HALJSonDeserializer" Version="1.1.5" />

 HALJSonDeserializer 1.1.5

This package can deserialize any String, Stream, or StreamReader (On HAL+JSON format or not) provided by a web api response. Installation: On the package console run : Install-Package HALJSonDeserializer Usage: After installation you must include the namespace of the package where you will use it: using haljson; So now: suppose that you want to call a web api via "http://localhost:8080/customer" in your c# code and to parse it into your custom type called "Customer". This can be done simply as follows: Customer theCustomer = JSonDeserializer.GetAndParse<Customer>("http://localhost:8080/customer"); For async call you can do this: Customer theCustomer = await JSonDeserializer.GetAndParseAsync<Customer>("http://localhost:8080/customer"); What about the post request? To post a request with parametters and receive a response you can do so: Create a Class For your request arguments here "GetFullNameRequest" and an other Class for the response here "GetFullNameResponse". GetFullNameRequest arg = new GetFullNameRequest{FirstName="Bart",LastName="Hansen"}; GetFullNameResponse fulName = await JSonDeserializer.PostAndParseResponseAsync<GetFullNameRequest,GetFullNameResponse>("http://localhost:8080/GetFullName",arg); If you just want to deserialize a Stream, a StreamReader or a string, there are three extension methods for them. You can do that as follows: Customer theCustomer = myStream.ToObject<Customer>(); //For a Stream Customer theCustomer = myStreamReader.ToObject<Customer>(); //For a StreamReader Customer theCustomer = myString.ToObject<Customer>(); //For a string

<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>HALJSonDeserializer</id>
    <version>1.1.5</version>
    <title>HALJSonDeserializer</title>
    <authors>Mamadou Samba DIALLO</authors>
    <owners>Mamadou Samba DIALLO</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>This package can deserialize any String, Stream, or StreamReader (On HAL+JSON format or not) provided by a web api response.  
Installation:
On the package console run :
Install-Package HALJSonDeserializer
Usage:
After installation you must include the namespace of the package where you will use it:
using haljson;
So now: suppose that you want to call a web api via "http://localhost:8080/customer" in your c# code and to parse it into your custom type called "Customer". This can be done simply as follows:
 Customer theCustomer =  JSonDeserializer.GetAndParse&lt;Customer&gt;("http://localhost:8080/customer");
For async call you can do this:
 Customer theCustomer = await JSonDeserializer.GetAndParseAsync&lt;Customer&gt;("http://localhost:8080/customer");
What about the post request?
To post a request with parametters and receive a response you can do so:
Create a Class For your request arguments here "GetFullNameRequest" and an other Class for the response here "GetFullNameResponse".
GetFullNameRequest arg = new GetFullNameRequest{FirstName="Bart",LastName="Hansen"};
GetFullNameResponse fulName = await JSonDeserializer.PostAndParseResponseAsync&lt;GetFullNameRequest,GetFullNameResponse&gt;("http://localhost:8080/GetFullName",arg);

If you just want to deserialize a Stream, a StreamReader or a string, there are three extension methods for them. You can do that as follows:
Customer  theCustomer = myStream.ToObject&lt;Customer&gt;();  //For a Stream
Customer  theCustomer = myStreamReader.ToObject&lt;Customer&gt;();  //For a StreamReader
Customer  theCustomer = myString.ToObject&lt;Customer&gt;(); //For a string</description>
    <summary>Parckage for deserializing HAL+JSon response datas</summary>
    <language>en-US</language>
  </metadata>
</package>