JSON

JSON

JSON is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.
Brandon  Adams

Brandon Adams

1625637060

What is JSON? | JSON Objects and JSON Arrays | Working with JSONs Tutorial

In this video, we work with JSONs, which are a common data format for most web services (i.e. APIs). Thank you for watching and happy coding!

Need some new tech gadgets or a new charger? Buy from my Amazon Storefront https://www.amazon.com/shop/blondiebytes

What is an API?
https://youtu.be/T74OdSCBJfw

JSON Google Extension
https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en

Endpoint Example
http://maps.googleapis.com/maps/api/geocode/json?address=13+East+60th+Street+New+York,+NY

Check out my courses on LinkedIn Learning!
REFERRAL CODE: https://linkedin-learning.pxf.io/blondiebytes
https://www.linkedin.com/learning/instructors/kathryn-hodge

Support me on Patreon!
https://www.patreon.com/blondiebytes

Check out my Python Basics course on Highbrow!
https://gohighbrow.com/portfolio/python-basics/

Check out behind-the-scenes and more tech tips on my Instagram!
https://instagram.com/blondiebytes/

Free HACKATHON MODE playlist:
https://open.spotify.com/user/12124758083/playlist/6cuse5033woPHT2wf9NdDa?si=VFe9mYuGSP6SUoj8JBYuwg

MY FAVORITE THINGS:
Stitch Fix Invite Code: https://www.stitchfix.com/referral/10013108?sod=w&som=c
FabFitFun Invite Code: http://xo.fff.me/h9-GH
Uber Invite Code: kathrynh1277ue
Postmates Invite Code: 7373F
SoulCycle Invite Code: https://www.soul-cycle.com/r/WY3DlxF0/
Rent The Runway: https://rtr.app.link/e/rfHlXRUZuO

Want to BINGE?? Check out these playlists…

Quick Code Tutorials: https://www.youtube.com/watch?v=4K4QhIAfGKY&index=1&list=PLcLMSci1ZoPu9ryGJvDDuunVMjwKhDpkB

Command Line: https://www.youtube.com/watch?v=Jm8-UFf8IMg&index=1&list=PLcLMSci1ZoPvbvAIn_tuSzMgF1c7VVJ6e

30 Days of Code: https://www.youtube.com/watch?v=K5WxmFfIWbo&index=2&list=PLcLMSci1ZoPs6jV0O3LBJwChjRon3lE1F

Intermediate Web Dev Tutorials: https://www.youtube.com/watch?v=LFa9fnQGb3g&index=1&list=PLcLMSci1ZoPubx8doMzttR2ROIl4uzQbK

GitHub | https://github.com/blondiebytes

Twitter | https://twitter.com/blondiebytes

LinkedIn | https://www.linkedin.com/in/blondiebytes

#jsons #json arrays #json objects #what is json #jsons tutorial #blondiebytes

What is JSON? | JSON Objects and JSON Arrays | Working with JSONs Tutorial
Autumn  Blick

Autumn Blick

1593251880

JSON Parsing in Android - Step by Step Implementation

JSON Structures in Android

JSON uses two types of brackets that are as follows:

  • [] – To declare the elements of Array in JSON, they’re written in square brackets.
  • {} – To create JSON objects, the elements are written in curly brackets.

JSON has the following types of structures that are:

1. JSON Objects

The elements inside the curly brackets are known as Objects.

2. JSON Array

A list of values, known as Arrays.

3. JSON Key-Value

This data is stored as a pair of keys and values. Here the keys can be a name, a number for which the values can be Seema, 98767586 etc.

Why JSON Parsing in Android over XML?

Let us see some reasons for why to choose JSON over XML:

  • It is much easier and quicker with high performance
  • It can use arrays
  • Its libraries do not depend on other libraries
  • The codes written in JSON are short, clean and easy to understand
  • It is free to open use and open-source tool
  • In JSON value retrieval is easy
  • It has a fully automated way of serializing/deserializing JavaScript.
  • It is supported by many Ajax toolkits and most of the backend technologies.

Examples of XML and JSON

Let us see the code difference of JSON and XML files:

XML Example:

<?xml version= “1.0” encoding= “” ?>
<student>
        <student>
  <name> Sia Sharma</name>
  <city> Chandigarh</city>
         </student>
        <student>
  <name>Dimple D’souza</name>
  <city> Nagpur</city>
         </student>
      <student>
  <name>Anna Jones</name>
  <city> Mumbai</city>
         </student>
  </student>

JSON Example:

{ “students”: [
{ “name”: “Sia Sharma”, “city”: “Chandigarh”},
{ “name”: “Prachi D’Souza”, “city”: “Nagpur”},
{ “name”: “Annas Jones”, “city”: “Mumbai”}
]}

I hope the difference is all clear in front of you. This is how simple JSON is and how easily it could be understood.

#android tutorials #json parsing in android #json parsing in android example #json parsing in android step by step #json parsing with android #read json file android

JSON Parsing in Android - Step by Step Implementation

lalit tomar

1598687041

JSON with Python - copyassignment.com

Hello friends, do you want to learn how to use JSON with Python? If Yes, then I recommend you must go to this website as I found this tutorial best to learn everything you need to learn hot to work on JSON with Python.
Link==> https://copyassignment.com/python/json-with-python/

#python #json with python #json #json

JSON with Python - copyassignment.com
Hollie  Ratke

Hollie Ratke

1596823200

# Google's Flutter Tutorial- Easily Parse Complex JSON, Create JSON Model Classes.

Welcome to Flutter tutorial

This demo helps you to easily parse any complex JSON data in to Dart Model classe easily.
Proper Error Handling in Flutter
https://www.youtube.com/watch?v=yA_BI

Visit http://coderzheaven.com for more tutorials.

Please don’t forget to LIKE, SUBSCRIBE & SHARE.
Please leave your valuable comments in the comment section below.
Thanks for watching.

#json #create-json #json-data #flutter

# Google's Flutter Tutorial- Easily Parse Complex JSON, Create JSON Model Classes.
Hollie  Ratke

Hollie Ratke

1596818640

Set the JSON body from an external JSON file in Postman

n this short tutorial, I will show you how to get your entire JSON request body from an external file.

This can be particularly useful if you want to use different data-sets but keep the same request.


// POSTMAN COMPLETE GUIDE ONLINE COURSE

👉 Want to learn more about Postman? Check my Postman online course.

Get it at a special price and help support this YouTube channel:

#json #postman #request-json

Set the JSON body from an external JSON file in Postman
Hollie  Ratke

Hollie Ratke

1596819600

SQL Server JSON Diff. Checking for differences between JSON documents.

If you are working on any module or routine such as a procedure, function or batch that produces a result, then you will want to compare it with something that you’ve prepared earlier to make sure that it is the same.

It is often necessary to compare objects, particularly when you are working on a routine that generates an object and you want to check that an improvement you’ve made is actually returned the same result. An XML or JSON document is the nearest we get to an object in SQL Server. This is probably as near as you’d want.

Although this routine is designed to compare JSON documents, and takes them as input, it can be used for comparing any results.

First Example

Imagine, if you can, that you are writing a routine that gives you a list of departments for every group within your AdventureWorks organisation. You want to do it the best way according to the version of SQL Server, but you want the two versions to give the same output. Fortunately, we have our table-valued function that compares any two results converted to JSON. Using this, called dbo.Compare_JsonObject, we can simply do this.

SELECT * FROM dbo.Compare_JsonObject(--compares two JSON Documents
-- here is your non-json query. This is just an example using 'string_agg'.
(SELECT GroupName, String_Agg(Name, ', ') WITHIN GROUP ( ORDER BY Name)  AS departments
  FROM AdventureWorks2016.HumanResources.Department
  GROUP BY GroupName
--and we then convert it to JSON
  FOR JSON AUTO),
-- here is your non-json query. This is an 'XML-trick' version to produce the list
(SELECT GroupName,
  (
  SELECT
    Stuff((
    SELECT ', ' + Name
      FROM AdventureWorks2016.HumanResources.Department AS dep
      WHERE dep.GroupName = TheGroup.GroupName ORDER BY dep.name
    FOR XML PATH(''), TYPE
    ).value('.', 'varchar(max)'),
  1,2,'')) AS departments
  FROM AdventureWorks2016.HumanResources.Department AS thegroup
  GROUP BY GroupName
--and we then convert it to JSON
  FOR JSON AUTO
  )
)
WHERE SideIndicator <> '==' --meaning ALL the items that don't match
--hopefully, nothing will get returned

Fortunately, we got this right and can slot the new version in place of the old one when we get that long-awaited upgrade to SQL Server. However, we can wind back in time to see the results before we got the list order correct.

SELECT * FROM dbo.Compare_JsonObject(--compares two JSON Documents
-- here is your non-json query. This is just an example using 'string_agg'.
(SELECT GroupName, String_Agg(Name, ', ') AS departments
  FROM AdventureWorks2016.HumanResources.Department
  GROUP BY GroupName
--and we then convert it to JSON
  FOR JSON AUTO),
-- here is your non-json query. This is an 'XML-trick' version to produce the list
(SELECT GroupName,
  (
  SELECT
    Stuff((
    SELECT ', ' + Name
      FROM AdventureWorks2016.HumanResources.Department AS dep
      WHERE dep.GroupName = TheGroup.GroupName
    FOR XML PATH(''), TYPE
    ).value('.', 'varchar(max)'),
  1,2,'')) AS departments
  FROM AdventureWorks2016.HumanResources.Department AS thegroup
  GROUP BY GroupName
--and we then convert it to JSON
  FOR JSON AUTO
  )
)
WHERE SideIndicator <> '==' --meaning ALL the items that don't match

which gives two mismatches, produced by different orders of the list items

We can see what doesn’t match, and we can see why: the ordering for those two rows is wrong.

Second Example

We could, of course, use variables to store our JSON

DECLARE @SourceJSON NVARCHAR(MAX) = '{

  "question": "What is a clustered index?",
  "options": [
    "A bridal cup used in marriage ceremonies by the Navajo indians",
    "a bearing in a gearbox used to facilitate double-declutching",
    "An index that sorts and store the data rows in the table or view based on the key values"
  ],
  "answer": 3
}',
@TargetJSON NVARCHAR(MAX) = '{

  "question": "What is a clustered index?",
  "options": [
	"a form of mortal combat referred to as ''the noble art of defense''",
    "a bearing in a gearbox used to facilitate double-declutching",
	"A bridal cup used in marriage ceremonies by the Navajo indians",
    "An index that sorts and store the data rows in the table or view based on the key values"

  ],
  "answer": 4
}'
SELECT SideIndicator, ThePath, TheKey, TheSourceValue, TheTargetValue
  FROM dbo.Compare_JsonObject(@SourceJSON, @TargetJSON) AS Diff;

which gies us all the differences

That side-indicator column is telling us things. A match is ‘==’, a difference is ‘<>’, a missing property in the source is ‘->’ and a missing property in the target is ‘<-‘

The ‘path’ column can be used to get the value of a property or to modify it. It uses the same convention as the SQL Server JSON functions.

There is also a parent column that is useful for doing more detailed comparison, or doing it at a particular level. Here, you can eliminate all values that are the same and still see what question had a different answer to it

SELECT ThePath, TheKey, TheSourceValue, TheTargetValue,
  Json_Value(@SourceJSON, TheParent + '.question') AS TheQuestion
  FROM dbo.Compare_JsonObject(@SourceJSON, @TargetJSON)
  WHERE SideIndicator = '<>';

#blogs #json #sql #sql-server #json-diff

SQL Server JSON Diff. Checking for differences between JSON documents.
Eleo Nona

Eleo Nona

1598584803

Format JSON Output in SQL Server

Introduction

From SQL Server 2016 JSON functions are introduced, since many modern Web and Mobile applications are using JSON data format for exchanging data. Many REST web service results are in format of JSON text or accept the data that is formatted as JSON. In this article, we will have a look How to Create or Format JSON text using relational data in SQL Server.

Disclaimer – The views/contents shared/authored in this article are mine and not of my employer. The table designs are JUST to convey the concepts and are not efficient ones.

Format JSON Output

The majorly used Format JSON text from SQL Server tables are

  • Auto Mode
  • Path Mode
Auto Mode

Auto mode, automatically formats JSON text, based on the SELECT Statements. All we need to specify the AUTO option at the end. Based on the order of columns in the SELECT statement the format of JSON is automatically determined. We cannot take the control to maintain the output.

To use FOR AUTO OPTION in the select statement must have **FROM **Clause in the query.

#sql server #for json #json

Format JSON Output in SQL Server
Houston  Sipes

Houston Sipes

1594341900

[HTB] JSON — Write-up

Welcome to the JSON box writeup! This was a medium-difficulty box and fun to play with. For the initial shell, you need to identify a vulnerability related to JSON-based deserialization on the website, and by leveraging this issue incorporated with a Bearer: header, you can get a RCE on the box. For the root shell, you can leverage a permissive permission configured for the initial user, SeImpersonatePrivilege, to perform a JuicyPotato exploit to get a SYSTEM shell. Let’s get started.

Recon

Nmap

As usual, let’s start with a basic Nmap discovery scan:

nmap -Pn --open -sC -sV -p- -T4 10.10.10.158

From the scan, we have some interesting ports:

  • FTP (21/TCP) —_ *Anonymous login was not allowed_
  • HTTP (80/TCP)
  • SMB (445/TCP) — *No null session allowed
  • WinRM (5985/TCP) — *A default port for Windows Remote Management (WinRM). If we have a user who is part of a “Remote Management Users” group and her credentials, we can gain a remote shell leveraging this service. However, this was not no need to gain an initial shell on this box.

Web Server (HTTP — 80/TCP)

So from the initial scan, it looks like we need to focus on the web server first.

The front page was a login page, and it was configured with weak credentials:

Username = admin : Password = admin

Once logged in as “Admin” user, it was pretty dead end with the website itself. Pages and functions were either static or 404 not found.

Web Server — Dirsearch

When you are targeting a web server, it is recommended to do directory brute-forcing to check if there are any hidden files/folders. I used Dirsearch tool to accomplish this.

/files/password.txt

There was a password.txt file under the /files folder, but it was a troll. -_-

However, an interesting file Account was found under the /api directory.

#hackthebox-writeup #json #json-writeup #juicypotato #hackthebox

[HTB] JSON — Write-up
Arno  Bradtke

Arno Bradtke

1598139540

JSON Schema vs. OpenAPI

JSON Schema and OpenAPI can seem similar but have different use-cases.

Image for post

To begin, how JSON Scheme and OPenAPI differ? Well, in contrast to JSON Schema, an OpenAPI document is a definition for an entire API, not just data models. One might compare JSON Schema with the OpenAPI data model.

Why the need to validate JSON?

There are a plethora of use-cases, but let me explain why I use it:

Enter the world of Kubernetes and you’ll find yourself surrounded by object manifests which are either defined as YAML or JSON. But having to maintain thousands of such manifests can be a nightmare if your code is repeated. Languages likejsonnet, a lazy data templating language by Google, let you DRYup (Don’t Repeat Yourself) the configuration code. The jsonnet spits JSON, offers template reuse, processes a code only if it is required. So not only does it give you a performance boost, it also takes away a big percentage of maintenance.

Good, now we have a lot of code written in jsonnet which generates JSON based manifests. Going forward, as custom JSON objects grow, we need some way to validate inputs and auto-document. This is when you would use OpenAPI.

JSON Schema

JSON schema, as defined at json-schema.org, is a powerful tool for validating the structure of JSON data.

At its heart, JSON is built on the following data structures:

  • **object**: for example { "key1": "value1", "key2": "value2" }
  • **array**: for example [ "first", "second", "third" ]
  • **numbers**: for example 423.1415926
  • **string**: for example "This is a string"
  • **boolean**: for example true and false
  • **null**: for example null

These types have analogs in most programming languages, though they may go by different names.

In JSON Schema, an empty object, **{}**, is a completely valid schema that will accept any valid JSON (any object, number, string, etc). You can also use true in place of empty object to represent a schema that matches anything, or false for a schema that matches nothing.

The most common thing to do in a JSON schema is to restrict to a specific type. The **type** keyword is used for that. For example,

{ "type": "string" }

The type keyword may either be a string or an array (in which case the JSON snippet is valid if it matches any of the given types).

{ "type": ["number", "string"] }

Since JSON Schema is itself JSON, it’s not always easy to tell when something is JSON Schema or just an arbitrary chunk of JSON. The **$schema** keyword is used to declare that something is a JSON Schema. It’s generally a good practice to include it, though it is not required.

{ "$schema": "http://json-schema.org/schema#" }

It is also best practice to include an **$id** property as a unique identifier for each schema. You can just set it to a URL at a domain you control, for example,

{ "$id": "http://yourdomain.com/schemas/myschema.json" }

#json #kubernetes #json-schema #validation #openapi-specification

JSON Schema vs. OpenAPI

JSON Schema and/vs. OpenAPI

Confused between JSON Schema and OpenAPI? Yeah, they seem similar, but have different use-cases. In one sentence, we can say:

In contrast to JSON Schema, an OpenAPI document is a definition for an entire API, not just data models.

You might like to compare JSON Schema with OpenAPI data model.

· JSON Schema

· OpenAPI

JSON Schema

JSON schema, as defined at json-schema.org, is a powerful tool for validating the structure of JSON data.

At its heart, JSON is built on the following data structures:

  • **object**: for example { "key1": "value1", "key2": "value2" }
  • **array**: for example [ "first", "second", "third" ]
  • **numbers**: for example 423.1415926
  • **string**: for example "This is a string"
  • **boolean**: for example true and false
  • **null**: for example null

These types have analogs in most programming languages, though they may go by different names.

In JSON Schema, an _empty object, _**_{}_****,**_ is completely valid schema that will accept any valid JSON (any object, number, string, etc). You can also use _true_ in place of empty object to represent a schema that matches anything, or _false_ for a schema that matches nothing._

The most common thing to do in a JSON schema is to restrict to a specific type. The **_type_** keyword is used for that. For example,

{ "type": "string" }

The _type_ keyword may either be a string or an array (in which case the JSON snippet is valid if it matches any of the given types).

{ "type": ["number", "string"] }

Since JSON Schema is itself JSON, it’s not always easy to tell when something is JSON Schema or just an arbitrary chunk of JSON. The **_$schema_** keyword is used to declare that something is JSON Schema. It’s generally a good practice to include it, thought it is not required.

{ "$schema": "http://json-schema.org/schema#" }

It is also best practice to include an **_$id_** property as a unique identifier for each schema. You can just set it to a URL at a domain you control, for example,

{ "$id": "http://yourdomain.com/schemas/myschema.json" }

Keywords specific to **_object_**** data type**:

  • The properties (key-value pairs) on an object are defined using the **properties** keyword. The value of properties is an object, where each key is the name of a property and each value is a JSON schema used to validate that property.
  • The **additionalProperties** keyword is used to control the handling of extra stuff, that is, properties whose names are not listed in the properties keyword. By default any additional properties are allowed. The additionalProperties keyword may be either a boolean or an object. If additionalProperties is a boolean and set to false, no additional properties will be allowed. If additionalProperties is an object, that object is a schema that will be used to validate any additional properties not listed in properties.
  • By default, the properties defined by the properties keyword are not required. However, one can provide a list of required properties using the **required** keyword. The required keyword takes an array of zero or more strings. Each of these strings must be unique.
  • The names of properties can be validated against a schema using **propertyNames**, irrespective of their values. This can be useful if you don’t want to enforce specific properties, but you want to make sure that the names of those properties follow a specific convention.
  • The number of properties on an object can be restricted using the **minProperties** and **maxProperties** keywords. Each of these must be a non-negative integer.
  • The **dependencies** keyword allows the schema of the object to change based on the presence of certain special properties. There are two forms of dependencies in JSON Schema:
  • Property dependencies declare that certain other properties must be present if a given property is present. The value of dependencies keyword is an object. Each entry in the object maps from the name of a property, p, to an array of strings listing properties that are required whenever p is present.
  • Schema dependencies declare that the schema changes when a given property is present. Schema dependencies work like property dependencies, but instead of just specifying other required properties, they can extend the schema to have other constraints.
  • As we saw before, additionalProperties can restrict the object so that it either has additional properties that weren’t explicitly listed, or it can specify a schema for any additional properties on the object. Sometimes this isn’t enough, and you may want to restrict the names of extra properties, or you may want to say that, given a particular kind of name, the value should match a particular schema. That’s where **patternProperties** comes in: it maps from regular expressions to schemas. If an additional property matches a given regular expression, it must also validate against the corresponding schema.
  • The patternProperties can be used in conjunction with additionalProperties. In that case, additionalProperties will refer to any properties that are not explicitly listed in properties and don’t match any of the patternProperties.

Keywords specific to **_string_****_number_****_boolean_** and **_null_**data types:

  • The length of a string can be constrained using the **minLength** and **maxLength**.
  • The **pattern** keyword is used to restrict a string to a particular regular expression.
  • The **format** keyword allows for basic semantic validation on certain kinds of string values that are commonly used. Check Built-in-formats.
  • Range of numbers are specified using a combination of **minimum** and **maximum** keywords (or **exclusiveMinimum** and **exclusiveMaximum** for expressing exclusive range).
  • The **boolean** keyword matches only two special values: **true** and **false**. Note that the values that evaluate to true or false, such as 1 and 0, are not accepted by the schema.
  • The **null** type is generally used to represent a missing value. When a schema specifies a type of null, it has only one acceptable value: **null**.

Keywords specific to **_array_**** data type**:

  • The **items** keyword:
  • Set items keyword to a single schema that will be used to validate all of the items in the array.
  • Set items keyword to an array, where each item is a schema that corresponds to each index of the document’s array. That is, an array where the first element validates the first element of the input array, the second element validates the second element of the input array, etc.
  • While items schema must be valid for every item in the array, the **contains** schema only needs to validate against one or more items in the array.
  • The **additionalItems** keyword controls whether it’s valid to have additional items in the array beyond what is defined in items. Setting it to false has the effect of disallowing extra items in the array. It can also be schema to validate against every additional item in the array.
  • The length of the array can be specified using the **minItems** and **maxItems** keywords. The value of each keyword must be a non-negative number.
  • A schema can ensure that each of the items in an array is unique. Simply set the **uniqueItems** keyword to true.

#json #open-api #openapi-specification #json-schema #validation

JSON Schema and/vs. OpenAPI
Ari  Bogisich

Ari Bogisich

1596280080

Mapping JSON to and from a C++ Structure

Introduction

I would like to define a c++ structure

struct Person {
 std::string name;
 int age;
 bool student;
} person;

pass the person instance to the mapping method along with JSON data

map_json_to_struct(person, json_data)

then use the filled structure

std::cout << person.name << " : " << person.age;

Or vice versa

map_struct_to_json(person, json_data, "  ");
std::cout << json_data.str() << std::endl;

get Person as JSON

{
 "name": "Agent K",
 "age": 42,
 "student": false
}

StructMapping is trying to solve these problems

Compatibility

Compilation is required with -std=c++17 Mainly for:

  • if constexpr
  • static inline

Compiler | platform combinations on which StructMapping has been tested:

  • GNU C++ 10.1.0 | Linux
  • Visual C++ 2019 and Microsoft ® C/C++ Optimizing Compiler Version 19.26.28806 for x64 | Windows 64-bit (except tests)

As types of member-data can be used

  • bool
  • char, unsigned char, short, unsigned short, int unsigned int, long, long long
  • float, double
  • std::string
  • std::list
  • std::vector
  • std::set (expected to be represented in JSON as an array)
  • std::unordered_set (expected to be represented in JSON as an array)
  • std::multiset (expected to be represented in JSON as an array)
  • std::unordered_multiset (expected to be represented in JSON as an array)
  • std::map (the key can only be std::string)
  • std::unordered_map (the key can only be std::string)
  • std::multimap (the key can only be std::string)
  • std::unordered_multimap (the key can only be std::string)
  • c++ structure
  • enumerations

Installation

StructMapping is a header-only C++ library. All library files are in the include folder.

To build examples and run tests proceed with the steps below (cmake required):

  1. create a directory called build in StructMapping source directory
  2. change to build directory
  3. run cmake .. command to configure your build
  4. run cmake --build . command. On successful build you will find binary files for examples and tests (under windows tests are not build) in the bin directory
  5. (not for windows) to run the tests run ctest (you can get detailed output using ctest -V)
  6. it is possible to install library system-wide by running cmake --install . command from the build tree with administrative privileges. This will install all files according to system preferences.

#json #c++ #json serialization #programming-c #cplusplus

Mapping JSON to and from a C++ Structure

JSON-P (JSON Processing) - Getting Started with MicroProfile

The JSON Processing (JSON-P) specification is all about creating JSON data structures and modifying them. Watch this video to learn everything you need to know about this specification.

» Corresponding blog post: https://rieckpil.de/whatis-json-processing-json-p/
» Source code on GitHub: https://github.com/rieckpil/getting-started-with-eclipse-microprofile
» More about MicroProfile: https://rieckpil.de/category/microprofile/

#json-p #json processing #microprofile

JSON-P (JSON Processing) - Getting Started with MicroProfile

JSON-B (JSON Binding) - Getting Started with MicroProfile

The JSON Binding (JSON-B) specification is all about binding JSON strings to Java objects and vice versa. Watch this video to learn everything you need to know about this specification.

» Corresponding blog post: https://rieckpil.de/whatis-json-binding-json-b/
» Source code on GitHub: https://github.com/rieckpil/getting-started-with-eclipse-microprofile
» More about MicroProfile: https://rieckpil.de/category/microprofile/

#json-b #microprofile #json binding

JSON-B (JSON Binding) - Getting Started with MicroProfile
Zena  Sporer

Zena Sporer

1596197880

Generating JSON Data From an Excel File

In the industry, there are many formats in which data can be stored. And each data format has its own limitation. In spite of there limitations, the JSON data format is very popular in the tech industry. Nowadays it is widely used everywhere. Microservices makes is very popular. But it comes with a very painful limitation. And the limitation is giving a comment. It is simply not possible to comment on a JSON file or data. And data without comment or documentation is very painful or dubious to understand or makes is difficult to make others understand.

A developer or architect can understand the JSON data, but make it meaningful to management to understand is painful. In this situation, we need a tool that can mitigate this pain. Just like a situation, where a person has written the data required for the address of a person or locality in an excel file as the image attached

#java #database #json #excel #json code #poi

Generating JSON Data From an Excel File
Giles  Goodwin

Giles Goodwin

1600044000

Creating your own simplified implementation of JSON.stringify()

You may already be familiar with the function JSON.stringify, which can be useful when comparing objects, implementing RESTFUL APIs or simply deep cloning a javascript object (although, it’s not recommended).

In this article, we are going to talk about how to create our own simplified version of this method, and learn how to improve its implementation step by step, covering more and more cases as we progress.

Image for post

If you are not familiar with this function, let’s take a look at what MDN has to say about it:

The **_JSON.stringify()_** method converts a JavaScript object or value to a JSON string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified.

Its syntax can be written like this:

JSON.stringify(value[, replacer[, space]])

Where “value” is the object or value we want to convert to a string. We can leave out the other 2 parameters for this article to make it easier.


Testing data

Consider this case:

const sampleObj = {
   "name": "Juan",
   "age": 29,
   "address": {
      "street": "Street 1",
      "number": 3
   }
}

If we apply the origin JSON.stringify() function to that object, this is what we get:

{"name":"Juan","age":29,"address":{"street":"Street 1","number":3}}

As you can see, it’s fairly easy. It adds double quotes to the attributes, and if the value is a string it adds them too. For this particular example, we’ll only tackle those 3 data types: Number, String and Object. We’ll leave out Function, dates, undefined values and so, just to keep it simple, although, I recommend you read the documentation of JSON.stringify to see how it behaves with those types and others.

#js #recursion #javascript #json #json-stringify

Creating your own simplified implementation of JSON.stringify()