Search This Blog

Tuesday, 2 June 2020

How to extract any properties from Json using online tool/website

How do I get ids from json array using online tool/website.

Steps as below

  1. Online Tool: json query tool
  2. Query: input.customer.map(({Id}) => Id)
  3. Query type: JavaScript
Sample "customer.json" file as below
{
  "customer": [
    {
      "Id": "173C0C69-C467-AC1D-E1EC-09329D5A55F3",
      "Name": "Harshal",
      "Mobile": "16531015 0130",
      "City": "Pune"
    },
    {
      "Id": "A0250FDE-A421-FEC9-E67A-346A2630D48B",
      "Name": "Indigo",
      "Mobile": "16251026 8085",
      "City": "Pietracatella"
    },
    {
      "Id": "6DF038AD-690F-1F66-7BBA-0317095F2C16",
      "Name": "Craig",
      "Mobile": "16761004 2272",
      "City": "Sawahlunto"
    },
    {
      "Id": "E1896D0D-B52A-811E-98FF-54ED33B62A62",
      "Name": "Kuame",
      "Mobile": "16880609 0653",
      "City": "Villeneuve-d'Ascq"
    },
    {
      "Id": "D0E623AB-9D12-6879-E5C2-E9DEF3806F1F",
      "Name": "Kelsie",
      "Mobile": "16600216 8448",
      "City": "Onoz"
    },
    {
      "Id": "7CE3E05B-B9F1-14F1-5CD7-F0E097B7C34B",
      "Name": "Glenna",
      "Mobile": "16470806 0563",
      "City": "The Hague"
    },
    {
      "Id": "3304E741-A5D3-9DFD-9775-3241B6B268C9",
      "Name": "Nicole",
      "Mobile": "16381107 1830",
      "City": "Budaun"
    },
    {
      "Id": "11AFE4F1-BBB9-E71F-9B04-98C8886C4685",
      "Name": "Eleanor",
      "Mobile": "16220806 0521",
      "City": "McCallum"
    },
    {
      "Id": "D29A626D-BA9C-9A60-89FE-82CA62CA2113",
      "Name": "Sara",
      "Mobile": "16860606 9261",
      "City": "Bevilacqua"
    }
  ]
}      
      

Result (Ids json array) as below
 
[
    "173C0C69-C467-AC1D-E1EC-09329D5A55F3",
    "A0250FDE-A421-FEC9-E67A-346A2630D48B",
    "6DF038AD-690F-1F66-7BBA-0317095F2C16",
    "E1896D0D-B52A-811E-98FF-54ED33B62A62",
    "D0E623AB-9D12-6879-E5C2-E9DEF3806F1F",
    "7CE3E05B-B9F1-14F1-5CD7-F0E097B7C34B",
    "3304E741-A5D3-9DFD-9775-3241B6B268C9",
    "11AFE4F1-BBB9-E71F-9B04-98C8886C4685",
    "D29A626D-BA9C-9A60-89FE-82CA62CA2113"
]        
        

Screenshot as below




Best way to compare json files online

Compare json files online.

Problem statement: How can I compare whether two JSON objects are equal using online tool/website, disregarding the order of lists?

first_sample.json document:

{
    "errors": [
        {"error": "invalid", "field": "email"},
        {"error": "required", "field": "name"}
    ],
    "success": false
}
        

second_sample.json document:
{
    "success": false,
    "errors": [
        {"error": "required", "field": "name"},
        {"error": "invalid", "field": "email"}
    ]
}
      
'first_sample.json' and 'second_sample.json' should compare equal, even though the order of the "errors" lists are different.



Solution

Step as below
  1. Sort both ('first_sample.json' and 'second_sample.json') file using Json sort online tool/website. ( json-sorter)
  2. Comapre json file using online compare tool/website. (diffnow)


Sort JSON screenshot as below



Compare JSON screenshot as below


Monday, 1 June 2020

Test Explorer (Visual Studio) shows 'Unknown Project'

Problem: Test Explorer (Visual Studio) shows '<Unknown project>'

 

Details: I created an class library project with Unit Tests project, and added a few unit tests. However, I have removed the failing test case from file but test explorer shows that Test Explore.


Solution

Steps as below

  1. Close Visual Sudio
  2. Go to project folder
  3. Find ".vs" folder. (Make sure your are also checking hidden item)
  4. Delete ".vs" folder.
  5. Good to go, Open visual studio, build and run project.



Wednesday, 15 April 2020

ASP.NET Core web API

Introduction to ASP.NET Core

ASP.NET Core :supports creating RESTful services, also known as web APIs, using C#. To handle requests, a web API uses controllers. Controllers in a web API are classes that derive from ControllerBase. This article shows how to use controllers for handling web API requests.


Saturday, 11 January 2020

Savvy SQL CHART (Book)

Savvy SQL CHART (Book)
Who is this book For?

if you can answer "YES" to all of these
  • Do you want to Learn "SQL"?
  • Do you like to tinker - Do you learn by doing. rather than just reading?
  • Do you want to brush up on SQL skill?
Shows you just what you need to know to stay competitive in a shifting marketplace.


Sample sql queries. Download Code

You will find correction, updates, all code listings and sample SQL script.

Please send me (harshalschaudhari@gmail.com) question, suggestions, corrections and gripes related to this book.



Tuesday, 12 November 2019

API Authentication

Reference · Identity & Access API Authentication Methods Four common ways a client proves who it is to a server, ord...

Recent Post