<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Morcatko</title>
    <description>The latest articles on DEV Community by Morcatko (@morcatko).</description>
    <link>https://dev.to/morcatko</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F133377%2Fabe94f9f-8b2c-4999-9c91-207e0d30fde3.png</url>
      <title>DEV Community: Morcatko</title>
      <link>https://dev.to/morcatko</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/morcatko"/>
    <language>en</language>
    <item>
      <title>Synctractor - Testing React/Vue apps with Protractor </title>
      <dc:creator>Morcatko</dc:creator>
      <pubDate>Tue, 14 May 2019 12:49:57 +0000</pubDate>
      <link>https://dev.to/morcatko/synctractor-testing-react-vue-apps-with-protractor-fcg</link>
      <guid>https://dev.to/morcatko/synctractor-testing-react-vue-apps-with-protractor-fcg</guid>
      <description>&lt;h1&gt;
  
  
  Protractor
&lt;/h1&gt;

&lt;p&gt;Probably every frontend developer have heard about Protractor. An end-to-end test framework for Angular. There are many other similar frameworks. However Protractor has one great feature when testing Angular application. It automatically waits for your website to be ready. It does not test your website in the middle of loading. Protractor knows when to wait and when to test.&lt;/p&gt;

&lt;p&gt;Protractor can be used with any website. No matter if it is written in Angular, React, jQuery or a static html. To be able to do that you have to disable a &lt;em&gt;synchronization&lt;/em&gt; in Protractor config file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;onPrepare: function() {
    browser.ignoreSynchronization = true;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This disables &lt;em&gt;waiting&lt;/em&gt; forcing Protractor to test as quickly as possible, even before your page fully loads and … most likely it will start failing.&lt;/p&gt;

&lt;p&gt;The workaround is to do the waiting manually.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;await browser.get("/login")
await $("#username").sendKeys("user");
await $("#password").sendKeys("password");
await $("#loginBUtton").click();
expect(await $("#message).getText()).toEqual("Welcome 'user'");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Code that is very clear and contains only user actions and expectations must be extended with waits, sleeps and timeouts&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;await browser.get("/login")
// Wait for page load by checking presence of login button
await browser.wait(EC.presenceOf($(#loginButton)));
await $("#username").sendKeys("user");
await $("#password").sendKeys("password");
await $("#loginButton").click();
// Wait for login call &amp;amp; new page render
await browser.sleep(2000);
expect(await $("#message).getText()).toEqual("Welcome 'user'");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This works but is very fragile. &lt;code&gt;browser.sleep&lt;/code&gt; waits 2 seconds. In that time the user will be most likely logged in (or maybe not). The usual "fix" is to use very long sleeps, wait for some specific page elements, or markers that your app injects into a page when it is ready or similar workarounds.&lt;/p&gt;

&lt;p&gt;You might be wondering how is it possible that it is so easy with Angular and so complicated with other frameworks. Well Protractor has actually two parts. One is the Protractor itself and the other piece is in Angular framework. These two parts communicate together during a running E2E test and ensure that everything works.&lt;/p&gt;
&lt;h1&gt;
  
  
  Synctractor
&lt;/h1&gt;

&lt;p&gt;There comes synctractor. A library that allows you to use Protractor with non-Angular apps (react, vue) and rely on build-in synchronization and automatic waiting. It wraps asynchronous calls (&lt;code&gt;fetch&lt;/code&gt;, &lt;code&gt;setTimeout&lt;/code&gt;) and provides needed information for Protractor during a test run by emulating the Angular part.&lt;/p&gt;

&lt;p&gt;It is easy to use&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;install it &lt;code&gt;npm i -save synctractor&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add this to the very first line of your app entry point
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    import * as synctractor from 'synctractor'; 
    synctractor.init();
    synctractor.monitorFetch();
    synctractor.monitorTimeout((_, t) =&amp;gt; t !== 11000);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;(see &lt;a href="https://github.com/Morcatko/synctractor#settimeout" rel="noopener noreferrer"&gt;github&lt;/a&gt; for explanation of the magic number 11000)&lt;/p&gt;

&lt;p&gt;That is it. You can remove &lt;code&gt;browser.ignoreSynchronization = true;&lt;/code&gt; from your Protractor config file and all sleeps from your spec files. Protractor will communicate with your app and wait when it is needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Morcatko/synctractor/tree/master/examples" rel="noopener noreferrer"&gt;Check React and Vue examples in a synctractor repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PS: Currently only fetch is supported. AJAX calls are not monitored and Protractor won't wait for it.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Morcatko" rel="noopener noreferrer"&gt;
        Morcatko
      &lt;/a&gt; / &lt;a href="https://github.com/Morcatko/synctractor" rel="noopener noreferrer"&gt;
        synctractor
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Angular-Protractor synchronization for non-angular apps (React, Vue, ...)
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Synctractor&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;Angular-Protractor synchronization for non-angular apps (React, Vue, ...)
Using this library you can get rid of almost all &lt;code&gt;browser.sleeps&lt;/code&gt; and &lt;code&gt;browser.waits&lt;/code&gt; in your protractor tests and relly on the same synchronization mechanism that is used by protract and angular.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Quick Setup&lt;/h2&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Install synctractor &lt;code&gt;npm i --save synctractor&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Remove &lt;code&gt;ignoreSynchronization&lt;/code&gt; from protractor config as it is not needed anymore&lt;/li&gt;
&lt;li&gt;Add this as the very first lines of your app entry point
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;import * as synctractor from 'synctractor';
synctractor.init();
synctractor.monitorFetch();
synctractor.monitorTimeout((_, t) =&amp;gt; t !== 11000); 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
(see &lt;code&gt;setTimeout&lt;/code&gt; details bellow for explanation of this magic number)&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Manual Mode&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;There is automatic mode (&lt;code&gt;synctractor.monitorXXX()&lt;/code&gt;) where you setup synctractor on your app entry point and that is all and there is also a manual mode, where you only initialize synctractor but you have to update calls all over your code. In automatic mode. you can get to unmonitored calls by &lt;code&gt;synctractor.nativeXXX()&lt;/code&gt;&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;…&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Morcatko/synctractor" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>testing</category>
      <category>react</category>
      <category>vue</category>
    </item>
    <item>
      <title>JSON Merge Patch in ASP.NET Core</title>
      <dc:creator>Morcatko</dc:creator>
      <pubDate>Mon, 04 Feb 2019 15:04:47 +0000</pubDate>
      <link>https://dev.to/morcatko/json-merge-patch-in-aspnet-core-1e10</link>
      <guid>https://dev.to/morcatko/json-merge-patch-in-aspnet-core-1e10</guid>
      <description>&lt;p&gt;REST is well-known and commonly used pattern for creating web APIs. There are many HTTP verbs, but the most frequently used for building REST services are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;POST - create new item&lt;/li&gt;
&lt;li&gt;GET - read item&lt;/li&gt;
&lt;li&gt;PUT - update/replace item&lt;/li&gt;
&lt;li&gt;DELETE - delete item&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These methods are usually enough for a client to make all operations with a resource. But what if the client wants to change only particular properties of a resource? &lt;br&gt;
For demonstration scenario lets say we have following object and we want to change the weapon property to "Knife"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    name: "James Bond"
    age: "45"
    weapon: "Gun"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Client code in pseudo-C#:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;srcJson = GET {resourceUrl}
model = Json.Parse&amp;lt;UserModel&amp;gt;(srcJson)
model.weapon = "Knife"
dstJson = Json.Serialize(model)
PUT {resourceUrl}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That is the obvious solution - GET the resource, modify it and PUT it back to a server. Depending on your architecture and used languages this might have some drawbacks.&lt;br&gt;
Imagine what happens when your UserModel is missing some properties. They will get lost and not send to the server in a PUT call. In case of default ASP.NET Core/C# setup they will be interpreted as a change to default values leading to a data loss.&lt;/p&gt;
&lt;h1&gt;
  
  
  JSON Patch
&lt;/h1&gt;

&lt;p&gt;PUT call replaces whole object rather then performing partial resource update only. &lt;a href="https://en.wikipedia.org/wiki/JSON_Patch" rel="noopener noreferrer"&gt;JSON Patch&lt;/a&gt; was created to modify the resource exactly as you want by sending list of operations rather then the object itself.&lt;/p&gt;

&lt;p&gt;JSON PATCH request&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
 { op: "replace", path: "/weapon", value: "Knife" }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Implementation of JSON Patch is part of ASP.NET Core,&lt;br&gt;
This structure allows full control of all properties of a resource including arrays, but also tends to be quite chatty and not very human writeable/readable. &lt;/p&gt;
&lt;h1&gt;
  
  
  JSON Merge Patch
&lt;/h1&gt;

&lt;p&gt;If you are looking for something simpler then JSON Patch, there is other way.&lt;br&gt;
&lt;a href="https://tools.ietf.org/html/rfc7396" rel="noopener noreferrer"&gt;JSON Merge Patch&lt;/a&gt; allows you to send changes in the form of original model. There is not a list of operations, but rather a patch object containing only changes that are merged with original resource on the server&lt;/p&gt;

&lt;p&gt;JSON Merge patch&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    weapon: "Knife"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And the result will be&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    name: "James Bond"
    age: "45"
    weapon: "Knife"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;JSON Merge patch is limited compared to full JSON Patch. You cannot remove a property (as missing property means "no change" rather then "remove") and also array operations are limited. &lt;/p&gt;
&lt;h1&gt;
  
  
  Morcatko.AspNetCore.JsonMergePatch
&lt;/h1&gt;

&lt;p&gt;Using JSON Merge Patch in C# is not easy. C# is statically typed language and JSON Merge Patch format expects the exact opposite - it defines the operations by property (non)existence.&lt;br&gt;
&lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch" rel="noopener noreferrer"&gt;Morcatko.AspNetCore.JsonMergePatch&lt;/a&gt; is my implementation of JSON Merge Patch for ASP.NET Core. It is designed to fit nicely into ASP.NET Core architecture. Its API is same as API of full JSON patch. All you have to do to use it is to initialize it in your startup class and make an endpoint that accepts patch object.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Startup.ConfigureServices
services
    .AddMvc()
    .AddJsonMergePatch();

// Controller
[HttpPatch]
[Consumes(JsonMergePatchDocument.ContentType)]
public void Patch(JsonMergePatchDocument&amp;lt;UserModel&amp;gt; patch)
{
    ...
    patch.ApplyTo(backendModel);
    ...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That is it.&lt;br&gt;
Notice the &lt;code&gt;Consumes&lt;/code&gt; attribute. You can use it together with full JSON Patch. Requests ContentType is a way how to distinquish betweens both versions.&lt;/p&gt;

&lt;p&gt;In case you are using swagger to generate API documentation for your service you will need to add a &lt;code&gt;DocumentFilter&lt;/code&gt; to your swagger configuration - see github for more details&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Morcatko" rel="noopener noreferrer"&gt;
        Morcatko
      &lt;/a&gt; / &lt;a href="https://github.com/Morcatko/Morcatko.AspNetCore.JsonMergePatch" rel="noopener noreferrer"&gt;
        Morcatko.AspNetCore.JsonMergePatch
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      JsonMergePatch support for ASP.NET Core
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;JSON Merge Patch support for ASP.NET Core&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/5e6c2b4bf8e363ba59537b86972d64b845f6acd9b9025341d8b736202ce09237/68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4d6f726361746b6f2e4173704e6574436f72652e4a736f6e4d6572676550617463682e737667" alt="Nuget"&gt;&lt;/a&gt; - &lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch" rel="nofollow noopener noreferrer"&gt;Morcatko.AspNetCore.JsonMergePatch&lt;/a&gt; (ASP.NET Core 2.x)&lt;br&gt;
&lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch.NewtonsoftJson" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/8dc5d8d04dbfa354cc45402a9b81c59490e85b8f575fe447db44526dbd6299ba/68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4d6f726361746b6f2e4173704e6574436f72652e4a736f6e4d6572676550617463682e4e6577746f6e736f66744a736f6e2e737667" alt="Nuget"&gt;&lt;/a&gt; - &lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch.NewtonsoftJson" rel="nofollow noopener noreferrer"&gt;Morcatko.AspNetCore.JsonMergePatch.NewtonsoftJson&lt;/a&gt; (ASP.NET Core 3+)&lt;br&gt;
&lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch.SystemText" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/1a2531849573312b468876551b236b2fe60f0dede5e7e694a4836cc960ccdb34/68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4d6f726361746b6f2e4173704e6574436f72652e4a736f6e4d6572676550617463682e53797374656d546578742e737667" alt="Nuget"&gt;&lt;/a&gt; - &lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch.SystemText" rel="nofollow noopener noreferrer"&gt;Morcatko.AspNetCore.JsonMergePatch.SystemText&lt;/a&gt; (ASP.NET Core 3+)&lt;br&gt;
&lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch.Document" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/0f8fa1a2113ba91871456bd85d9c559c9f10b24d3724b1c764a111bc29591ca1/68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f4d6f726361746b6f2e4173704e6574436f72652e4a736f6e4d6572676550617463682e446f63756d656e742e737667" alt="Nuget"&gt;&lt;/a&gt; - &lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch.Document" rel="nofollow noopener noreferrer"&gt;Morcatko.AspNetCore.JsonMergePatch.Document&lt;/a&gt; (ASP.NET Core 3+ - base package)&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;JSON Merge Patch&lt;/h3&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://tools.ietf.org/html/rfc7396" rel="nofollow noopener noreferrer"&gt;RFC 7396&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;performs partial resource update similar to JSON Patch&lt;/li&gt;
&lt;li&gt;Supports Swagger&lt;/li&gt;
&lt;li&gt;netstandard 2.0&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;C# object:&lt;/p&gt;
&lt;div class="highlight highlight-source-cs notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-smi"&gt;var&lt;/span&gt; &lt;span class="pl-s1"&gt;backendModel&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-k"&gt;new&lt;/span&gt; Model&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt;
&lt;span class="pl-kos"&gt;{&lt;/span&gt;
    &lt;span class="pl-s1"&gt;Name&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s"&gt;&lt;span class="pl-s"&gt;"&lt;/span&gt;James Bond&lt;span class="pl-s"&gt;"&lt;/span&gt;&lt;/span&gt;
    &lt;span class="pl-s1"&gt;Age&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s"&gt;&lt;span class="pl-s"&gt;"&lt;/span&gt;45&lt;span class="pl-s"&gt;"&lt;/span&gt;&lt;/span&gt;
    &lt;span class="pl-s1"&gt;Weapon&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s"&gt;&lt;span class="pl-s"&gt;"&lt;/span&gt;Gun&lt;span class="pl-s"&gt;"&lt;/span&gt;&lt;/span&gt;
&lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;JSON Merge Patch:&lt;/p&gt;
&lt;div class="highlight highlight-source-cs notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt; &lt;span class="pl-smi"&gt;var&lt;/span&gt; &lt;span class="pl-s1"&gt;mergePatch&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-k"&gt;new&lt;/span&gt; &lt;span class="pl-smi"&gt;object&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
   &lt;span class="pl-s"&gt;&lt;span class="pl-s"&gt;"&lt;/span&gt;Weapon&lt;span class="pl-s"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span class="pl-c1"&gt;:&lt;/span&gt; &lt;span class="pl-s"&gt;&lt;span class="pl-s"&gt;"&lt;/span&gt;Knife&lt;span class="pl-s"&gt;"&lt;/span&gt;&lt;/span&gt;
 &lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Resulting C# object:&lt;/p&gt;
&lt;div class="highlight highlight-source-cs notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-smi"&gt;var&lt;/span&gt; &lt;span class="pl-s1"&gt;newObject&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-k"&gt;new&lt;/span&gt; Model&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
  &lt;span class="pl-s1"&gt;Name&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s"&gt;&lt;span class="pl-s"&gt;"&lt;/span&gt;James Bond&lt;span class="pl-s"&gt;"&lt;/span&gt;&lt;/span&gt;
  &lt;span class="pl-s1"&gt;Age&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s"&gt;&lt;span class="pl-s"&gt;"&lt;/span&gt;45&lt;span class="pl-s"&gt;"&lt;/span&gt;&lt;/span&gt;
  &lt;span class="pl-s1"&gt;Weapon&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-s"&gt;&lt;span class="pl-s"&gt;"&lt;/span&gt;Knife&lt;span class="pl-s"&gt;"&lt;/span&gt;&lt;/span&gt;
&lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;How to&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;code&gt;2.1-testApp&lt;/code&gt;, &lt;code&gt;3.0 testApp&lt;/code&gt; or &lt;code&gt;6.0/testApp&lt;/code&gt; for sample&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install nuget (Use JsonMergePathch version same as your .NET) .&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;ASP.NET Core 2.x &lt;a href="https://www.nuget.org/packages/Morcatko.AspNetCore.JsonMergePatch" rel="nofollow noopener noreferrer"&gt;Morcatko.AspNetCore.JsonMergePatch&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ASP.NET Core 3+ (Newtonsoft.Json)…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Morcatko/Morcatko.AspNetCore.JsonMergePatch" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>aspnetcore</category>
      <category>csharp</category>
    </item>
  </channel>
</rss>
