{"id":331551,"date":"2022-04-05T21:00:11","date_gmt":"2022-04-05T21:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=331551"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=331551","title":{"rendered":"<span>Yet another JSON-\u043f\u0430\u0440\u0441\u0435\u0440<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0412\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 JSON-\u043f\u0430\u0440\u0441\u0435\u0440 (\u0441 <s>\u0436\u0443\u043a\u0430\u043c\u0438 \u0438<\/s> \u0444\u0438\u0447\u0430\u043c\u0438). \u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 <em>well-formed<\/em> JSON-\u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c JSON-\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442. <strong>JSON-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/strong> &#8212; \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043d\u0435\u0443\u043a\u043e\u0441\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0438 \u044f\u0437\u044b\u043a\u0430.  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a \u0438 RFC, \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON. \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc8259\" rel=\"noopener noreferrer nofollow\">RFC 8259<\/a>. <\/p>\n<h3>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f <\/h3>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0433\u0443\u0433\u043b\u043e\u0432\u0441\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 JSON \u0442\u0435\u043a\u0441\u0442\u0430. <\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439, <s>\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439<\/s>  \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API \u0441 \u0431\u043e\u0433\u0430\u0442\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0432\u0435\u0449\u0435\u0439.<\/p>\n<p>\u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0441\u0442\u044c. \u0412\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0441\u0432\u043e\u0451 \u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435.<\/p>\n<h2>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b JSON.<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0432\u0437\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u0448 \u043f\u0430\u0440\u0441\u0435\u0440? \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 JSON-\u0444\u043e\u0440\u043c\u0430\u0442\u0443?&#187; \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 JSON, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u043e\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u0443\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c? \u0422\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u0411\u0443\u0434\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a RFC. \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u0435\u0441\u0442\u044c 4 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0438 2 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0445 (\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b). \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043d\u0435-\u0441\u0442\u0440\u0443\u043a\u0442\u0440\u0443\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c  \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430. \u0412\u0441\u0435 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <em>JsonElement<\/em>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 JSON-\u0435.<\/p>\n<pre><code class=\"java\">public abstract class JsonElement&lt;T> { \/\/T - \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 JSON.     public abstract T getValue(); \/\/\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435.    \/\/\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f     @Override     public String toString(){         return getValue().toString();      }  }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 JsonElement \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0435\u0433\u043e \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u043a\u0443, \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <em>getValue<\/em>.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0431\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (<strong>boolean<\/strong>). \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441 JsonBoolean \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 \u043e\u0442 JsonElement&lt;Boolean>.<\/p>\n<pre><code class=\"java\">public class JsonBoolean extends JsonElement&lt;Boolean> { \/\/\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 - Boolean      private boolean v;        \/\/\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e = false.     public JsonBoolean(){       this.v = false;     }        \/\/\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430.   public JsonBoolean(Boolean b){      this.v = b;      }        \/\/\u041c\u043d\u0435\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.     \/\/t = true (t stands for true). \u041a\u0430\u043a \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435.     \/\/other = false. (\u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u0440\u043e\u043c\u0435 't').     public JsonBoolean(Character c){         this.v = (c == 't');     }      @Override     public Boolean getValue() {         return v;     }  }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (Number). \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0432 JSON \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0442\u0430\u043a \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439. \u0414\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043e\u0442 \u0447\u0438\u0441\u0435\u043b \u0441 \u0442\u043e\u0447\u043a\u043e\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <em>JsonNumber<\/em> \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430. \u0415\u0433\u043e \u043a\u043e\u0434 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u0441\u0445\u0435\u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"java\">public class JsonNumber extends JsonElement&lt;Number> { \/\/ \u0427\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0442\u0438\u043f - Number.      private Number n;      \/\/\u041d\u0435 \u0437\u043d\u0430\u0435\u043c \u0442\u043e\u0447\u043d\u043e, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 Number.     public JsonNumber(Number n){         this.n = n;     }        @Override     public Number getValue() {         return n;     } }<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0436\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, JsonRealNumber \u0435\u0449\u0451 \u043f\u0440\u043e\u0449\u0435:<\/p>\n<pre><code class=\"java\">public class JsonRealNumber extends JsonNumber { \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f JsonNumber.      \/\/\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439.     \/\/Float \u0438\u043b\u0438 Double.     public JsonRealNumber(Float n){          super(n);     }     public JsonRealNumber(Double n) {         super(n);     } }<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f <em>JsonString<\/em> \u0438 \u0442\u0438\u043f <em>JsonNull<\/em> \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <strong>null <\/strong>(\u0434\u0430, \u0434\u043b\u044f null &#8212; \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0430\u0436 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441.). \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<pre><code class=\"java\">public class JsonString extends JsonElement&lt;String> {          private String val;     public JsonString(String v){         this.val = v;     }      @Override     public String getValue() {         return val;     }      \/\/ \u041d\u0435 \u043d\u0430\u0434\u043e \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c getValue(), \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430.     @Override     public String toString(){         return val;     } }  \/\/\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 JsonNull.java public class JsonNull extends JsonElement&lt;String> {     @Override     public String getValue() {         return \"null\";  \/\/\u041f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \"null\"     } }<\/code><\/pre>\n<p>\u041e\u0431\u044a\u044f\u0441\u043d\u0438\u043c \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 <strong>getValue()<\/strong> \u0443 \u0442\u0438\u043f\u0430 <em>JsonNull<\/em>. \u041a\u0430\u043a \u0412\u044b \u0443\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 <strong>&#171;null&#187;<\/strong> \u0442\u0438\u043f\u0430 JsonString \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c  \u0442\u0438\u043f\u0430 JsonNull. \u041e\u0442\u043b\u0438\u0447\u0438\u0442\u044c \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 JsonNull.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u043c \u0442\u0438\u043f\u0430\u043c. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 &#8212; \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 <em>JsonElement<\/em>. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b, \u043a\u043b\u0430\u0441\u0441 <em>JsonArray <\/em>(\u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430), \u043b\u0438\u0448\u044c \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 ArrayList&lt;JsonElement>. \u0415\u0433\u043e \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0434\u0430\u043b\u0435\u0435.<\/p>\n<pre><code class=\"java\">\/* JsonArray - \u043a\u0430\u043a List of JsonElements. *\/ public class JsonArray extends JsonElement&lt;List&lt;JsonElement>> {     private List&lt;JsonElement> elements;     private int c; \/\/ 'c' stands for count (\u0447\u0438\u0441\u043b\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432).     private String pName; \/\/ \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d.      public JsonArray(){         this.elements = new ArrayList&lt;>();         this.c = 0;         this.pName = null;     }      public JsonArray(List&lt;JsonElement> elements){         this.elements = elements;         this.c = elements.size();         this.pName = null;     }      \/\/\u041c\u0435\u043d\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 (\u041d\u0415 addElements)!     public void setElements(List&lt;JsonElement> elements) {         this.elements = elements;     }      public &lt;T> void add(JsonElement&lt;T> e){         elements.add(e);         c++;     }      public void setPropertyName(String pName) {         this.pName = pName;     }      public String getPropertyName(){         return pName;     }      public ArrayList&lt;JsonElement> getElements() {         return elements;     }      \/\/getCount().     public int getC() {         return c;     }      @Override     public List&lt;JsonElement> getValue() {         return elements;     }<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u0438\u043f &#8212; \u043e\u0431\u044a\u0435\u043a\u0442\u044b JSON. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430  \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0430\u0440\u044b \u00ab\u0438\u043c\u044f-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb, \u0433\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c (\u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432), \u043b\u0438\u0431\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u043b\u0438\u0441\u044c \u0432\u044b\u0448\u0435. \u0418\u043c\u0435\u043d\u0430 &#8212; \u0441\u0443\u0442\u044c \u043a\u043b\u044e\u0447\u0438. \u0422\u0438\u043f \u043a\u043b\u044e\u0447\u0435\u0439 &#8212; \u0441\u0442\u0440\u043e\u043a\u0430. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u0430\u0440, \u0438 \u0438\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d (\u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u0442.\u0434.).<\/p>\n<pre><code class=\"java\">\/* LinkedHashMap - \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.   \u041d\u0443\u0436\u043d\u0430\u044f \u0432\u0435\u0449\u044c, \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0435 \u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440.    TKey = String. (\u0422\u0438\u043f \u043a\u043b\u044e\u0447\u0430 - \u0441\u0442\u0440\u043e\u043a\u0438).    TValue - V. (\u041f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439). *\/ public class StrLinkedHashMap&lt;V> extends LinkedHashMap&lt;String, V> {        \/\/\u041c\u0435\u0442\u043e\u0434, \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0443 \u043f\u0430\u0440.     @Override     public String toString(){         Set&lt;String> keys = keySet();                \/\/\u041d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438.         \/\/(\u041d\u0435\u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0435\u043d! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 StringBuffer)         StringBuilder sb = new StringBuilder();                sb.append(\"{\\n\\t\"); \/\/ \u0438\u043c\u0435\u043d\u0430 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438.                  Iterator&lt;String> t = keySet().iterator();         while(t.hasNext()){             String k = t.next();             sb.append(k+\" : \"+get(k).toString());             if(t.hasNext())                 sb.append(\",\\n\\t\");         }         sb.append(\"}\");         return sb.toString();     } }<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430-\u043e\u0431\u044a\u0435\u043a\u0442\u0430 JSON. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c JSON-\u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <em>JsonObject<\/em>.<\/p>\n<pre><code class=\"java\">public class JsonObject extends JsonElement&lt;StrLinkedHashMap&lt;JsonElement>> {     private StrLinkedHashMap&lt;JsonElement> table; \/\/ \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435      public JsonObject(){         this.table = new StrLinkedHashMap&lt;>();     }      public void Put(String k, JsonElement id){         this.table.put(k,id);     }      \/\/inherits from LinkedHashMap.     \/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0443.     \/\/ \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430.     \/\/ \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043f\u0430\u0440, \u043f\u043e \u043a\u043b\u044e\u0447\u0443 k.     \/\/ \u041d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 (\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438).     public JsonElement Get(String k){\/\/get element on the root level.         return table.get(k);     }            \/\/\u0421\u0438\u043d\u043e\u043d\u0438\u043c \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 Get(String k).     public JsonElement getProperty(String pname){         return table.get(pname);     }      \/\/get Element by path using path dot notation.     \/\/ \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438.     public JsonElement getElement(String path){         ArrayList&lt;String> p = new ArrayList&lt;>();                \/\/\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0441\u043b\u043e\u0432\u0430 \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e \u0442\u043e\u0447\u043a\u0430 '.'         Pattern regex = Pattern.compile(\"\\\\w([^.]*)\");          Matcher m = regex.matcher(path);          while(m.find())             p.add(m.group());         StrLinkedHashMap&lt;JsonElement> cnode = table;\/\/ROOT. \u041a\u043e\u0440\u0435\u043d\u044c.         JsonElement n  = null;                \/\/\u0415\u0441\u043b\u0438 \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0431\u0435\u0437 \u0442\u043e\u0447\u0435\u043a -> \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e.         if(p.size() == 0)              return getProperty(path);                \/\/ \u0414\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0432\u0433\u043b\u0443\u0431\u044c, \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \"A.B.C\"         for(String c : p){             n = cnode.get(c);                         if(n == null) \/\/\u041d\u0438\u0447\u0435\u0433\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0442 (\u0434\u0430\u0436\u0435 null \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438)                 return n; \/\/ \u0431\u0443\u0434\u0435\u0442 null \u0432 \u043a\u043e\u0434\u0435.                        try {\/\/is interior node                 \/\/cnode - \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438.                 \/\/ \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0442\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e.                 cnode = (StrLinkedHashMap&lt;JsonElement>) n.getValue(); \/\/ isTable.             }catch (ClassCastException e){\/\/that was leaf. (\u043d\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0442\u0438\u043f).                 return cnode.get(c); \/\/\u0418\u0437\u0432\u043b\u0435\u0447\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.             }         }         return n;     }      \/\/\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 - \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043f\u0430\u0440 \"\u0438\u043c\u044f\" : \"\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\".     @Override     public StrLinkedHashMap&lt;JsonElement> getValue() {         return table;     }      \/\/\u041d\u0435\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e, \u044f\u0432\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u044d\u043a\u0430, \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0432\u0441\u0451 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435,     \/\/\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b.     @Override     public String toString(){         StringBuilder sb = new StringBuilder();         LinkedStack&lt;Triple&lt;String, JsonElement,String>> S = new LinkedStack&lt;>();\/\/entity         LinkedStack&lt;Integer> T = new LinkedStack&lt;>();\/\/count of tabs (\\t symbol)         int tabs = 0;\/\/current count of tabs         T.push(0);         S.push(new Triple&lt;>(\"\", this, \"\"));         while(!S.isEmpty()){             tabs = T.top();             T.pop();             _addTabs(sb,tabs);              String prop = S.top().getV1();             sb.append(prop);             JsonElement e = S.top().getV2();             String c = S.top().getV3();             S.pop();             if(e instanceof JsonObject){                 \/\/WRITE BOUND OF OBJECT AND INCREMENT(tabs)                 sb.append('{').append('\\n');                  T.push(tabs);                 S.push(new Triple&lt;>(\"\", new JsonLiteral(\"}\"), c));                  \/\/ADD &lt;key, value> pair to the STACK.                 JsonObject ob = (JsonObject)e;                 Iterator&lt;String> ks = ob.table.keySet().iterator();                  \/\/FIRST ITERATION (put to stack entry without comma)                 if(ks.hasNext()) {                     String p = ks.next();                     String v1 = \"\\\"\" + p + \"\\\"\" + \" : \";                     S.push(new Triple&lt;>(v1, ob.getProperty(p), \"\"));                     T.push(tabs + 1);                 }                  \/\/put others with comma                 while(ks.hasNext()){                     String p = ks.next();                     String v1 = \"\\\"\" + p + \"\\\"\" + \" : \";                     S.push(new Triple&lt;>(v1, ob.getProperty(p), \",\"));                     T.push(tabs + 1);                 }             }             else if(e instanceof JsonArray){                 ArrayList&lt;JsonElement> arr = ((JsonArray)e).getValue();                 int s = arr.size();                 sb.append('[').append('\\n');                  S.push(new Triple&lt;>(\"\", new JsonLiteral(\"]\"), c));                 T.push(tabs);                  \/\/FIRST ITERATION                 JsonElement el = arr.get(s - 1);                 s--;                 S.push(new Triple&lt;>(\"\", el, \"\"));                 T.push(tabs + 1);                  \/\/put others with comma.                 while(s != 0){                     el = arr.get(s - 1);                     s--;                     S.push(new Triple&lt;>(\"\", el, \",\"));                     T.push(tabs + 1);                 }             }             else if(e instanceof JsonLiteral || e instanceof JsonNull || e instanceof JsonNumber || e instanceof JsonBoolean){                 sb.append(e.getValue().toString()).append(c).append('\\n');             }             else if(e instanceof JsonString){                 sb.append('\\\"').append(((JsonString) e).getValue()).append('\\\"').append(c).append('\\n');             }         }         return sb.toString();     }      \/\/\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0430\u0431\u044b.     private void _addTabs(StringBuilder sb, int tabs){         int k = 0;         while(k &lt; tabs){             sb.append('\\t');             k++;         }     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0431\u044b\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f &#8212; JsonLiteral. \u041e\u043d \u043b\u0438\u0448\u044c \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e. \u0415\u0433\u043e \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"java\">public class JsonLiteral extends JsonString {     public JsonLiteral(String v) {         super(v);     } }<\/code><\/pre>\n<h2>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0430\u0440\u0441\u0435\u0440\u0430.<\/h2>\n<p>\u041f\u0430\u0440\u0441\u0435\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 JSON, \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430-JSON. \u0422.\u0435. \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 <em>JsonObject<\/em>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u044d\u043a\u0438. \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u0443\u044e \u043b\u0435\u043a\u0441\u0435\u043c\u0443 \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043d\u0430 \u0432\u0440\u0435\u043c\u044f \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c. \u0418 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (\u043e\u0448\u0438\u0431\u043a\u0438), \u043f\u0440\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u043a JSON-\u0443.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0430\u0440\u0441\u0435\u0440\u0430, <em>SimpleJsonParser<\/em>.<\/p>\n<pre><code class=\"java\">public class SimpleJsonParser {      private JsParserState state; \/\/\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0430\u0440\u0441\u0435\u0440\u0430.   private char[] buf; \/\/\u0411\u0443\u0444\u0435\u0440 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430.   private int bsize; \/\/\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430   private int bufp; \/\/\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u0435.       private int line; \/\/line, col - \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435.    private int col;    private JsonElement curVal; \/\/\u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442.     \/\/\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0441 \u0431\u0443\u0444\u0435\u0440\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 bsize.    \/\/\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 - START, \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 = 0,    \/\/\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 - \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446. (1, 0).    public SimpleJsonParser(int bsize){         this.state = JsParserState.START; \/\/START - \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.         this.buf = new char[bsize];         this.bsize = bsize;         this.bufp = 0;         this.line = 1;         this.col = 0;    }     \/\/\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - 255 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.    public SimpleJsonParser(){         this(255);    }  \/\/...other code. }<\/code><\/pre>\n<p>\u0430 \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 &#8212; <em>JsonParseException<\/em>.<\/p>\n<pre><code class=\"java\">\/\/\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u0441\u044f \u043e\u0442 RuntimeException - \/\/ - \u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \/\/ - \u043d\u0435 \u043d\u0430\u0434\u043e \u043e\u0431\u0451\u0440\u0442\u044b\u0432\u0430\u0442\u044c try\/catch (\u0432 Runtime \u0443\u043f\u0430\u0434\u0451\u0442). public class JsonParseException extends RuntimeException {     public JsonParseException(String message, Throwable throwable){         super(message, throwable);     } }<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0432\u0445\u043e\u0434\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u043e\u043c <em>InputStream<\/em>. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0447\u0438\u0442\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435.<\/p>\n<pre><code class=\"java\"> public class SimpleJsonParser {        \/\/\u041f\u043e\u043b\u044f \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430....        \/\/\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u043c\u0443 \u0438\u043b\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 File.    public JsonObject parse(String fileName) {         File f = new File(fileName);         return parse(f);    }          public JsonObject parse(File fl){        JsonObject result = null;        try(FileInputStream f = new FileInputStream(fl.getAbsolutePath());        ){            result = parseStream(f);        } catch (FileNotFoundException e){            System.out.println(e.getMessage());            flushBuf();        } catch (IOException e){            System.out.println(e.getMessage());            this.state = JsParserState.START; \/\/\u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 - \u043d\u0430\u0437\u0430\u0434 \u043a \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e.            flushBuf();            this.col = 0; this.line = 1;            return null;        }        return result;    }     \/\/\u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 InputStream,    \/\/ \u0438\u043b\u0438 \u0436\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c, \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0444\u0430\u0439\u043b\u0430.    public JsonObject parseStream(InputStream in){      \/\/TODO: \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 IN.        return null;      }        \/\/\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0431\u0443\u0444\u0435\u0440\u0430, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u043d\u043e\u043b\u044c.    private void flushBuf(){         bufp = 0;         for(int i = 0; i &lt; this.buf.length; i++){             this.buf[i] = '\\u0000';         }     }  }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c, \u0442\u043e <em>InputStream<\/em> \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0430\u043c\u0438. \u041d\u0443\u0436\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f &#8212; <em>InputStreamReader<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432, \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0438\u043c\u0451\u043d \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0448\u0438\u043d (\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432) \u0432 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u044d\u043a\u0430: J_OBJS, J_ARRS, J_ROOTS, props. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 JSON-\u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e \u0432\u0441\u0435\u043c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c (\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043a\u0430\u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 CLOSEROOT), \u043b\u0438\u0431\u043e \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0439 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 (\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043a\u0430\u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 ERR). \u0412 \u0438\u0442\u043e\u0433\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435 \u0441\u0442\u044d\u043a\u0430 J_OBJS, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0430\u0440\u0441\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>JsonObject<\/em>. \u0418\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 <em>iterate<\/em>.<\/p>\n<pre><code class=\"java\">public JsonObject parseStream(InputStream in){         LinkedStack&lt;JsonObject> J_OBJS = new LinkedStack&lt;>();         LinkedStack&lt;JsonArray> J_ARRS = new LinkedStack&lt;>();         LinkedStack&lt;JsonElement> J_ROOTS = new LinkedStack&lt;>();         LinkedStack&lt;String> props = new LinkedStack&lt;>();          \/\/InputStreamReader \u043e\u0442 InputStream.         try(InputStreamReader ch = new InputStreamReader(in)){             this.state = JsParserState.START;\/\/ before read set parser to the start state.             this.col = 0; this.line = 1;             flushBuf(); \/\/\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439.                        \/\/\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b.             while(this.state != JsParserState.CLOSEROOT &amp;&amp; this.state != JsParserState.ERR)                 iterate(J_OBJS, J_ARRS, J_ROOTS, props, ch);             if(this.state == JsParserState.ERR)                 return null; \/\/\u0415\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430, \u0442\u043e null.          } catch (IOException e){ \/\/\u041e\u0448\u0438\u0431\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f - null (\u0441\u043c. \u0432\u044b\u0448\u0435).             System.out.println(e.getMessage());             System.out.println(\"At (\" + line + \":\" + col + \")\");             flushBuf();             return null;         }         return J_OBJS.top(); }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u043f\u0438\u0448\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <em>iterate<\/em> \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438.<\/p>\n<pre><code class=\"java\">     private void iterate(LinkedStack&lt;JsonObject> J_OBJS, LinkedStack&lt;JsonArray> J_ARR,                         LinkedStack&lt;JsonElement> J_ROOTS, LinkedStack&lt;String> props, InputStreamReader r) throws IOException{         int c = (int)' ';         JsonObject cur_obj = null;         while(c == ' ' || c == '\\n' || c == '\\r' || c == '\\t') { \/\/skip spaces             c = getch(r);         }          \/\/JSON_OBJ -> { PROPS } | { }.         if(this.state == JsParserState.AWAIT_PROPS_OR_END_OF_OBJ &amp;&amp; c == '}' &amp;&amp; ungetch('}') == 0)             err('}', \"available space for '}' but OutOfMemory!\");          else if(this.state == JsParserState.AWAIT_PROPS_OR_END_OF_OBJ &amp;&amp; c == '}'){ \/\/ side effect from previous if [ ungetch('}') call]!             this.state = JsParserState.NEXT_VALUE; \/\/ just goto NEXT_VALUE where all checks.         }         else if(this.state == JsParserState.AWAIT_PROPS_OR_END_OF_OBJ &amp;&amp; ungetch((char) c) == 0) \/\/ ungetch call produces side effect for next else if branch             err(c, \"available space for '\"+(char) c +\"' but OutOfMemory!\");          else if(this.state == JsParserState.AWAIT_PROPS_OR_END_OF_OBJ)             this.state = JsParserState.AWAIT_PROPS;          else if(this.state == JsParserState.START &amp;&amp; c != '{') \/\/Json object must starts with '{'             err(c, \"{\");          else if(this.state == JsParserState.START){ \/\/ state = Start, c == '{'             J_OBJS.push(new JsonObject());             J_ROOTS.push(J_OBJS.top());             this.state = JsParserState.AWAIT_PROPS_OR_END_OF_OBJ;         }         \/\/ MEMBER -> >\" propName \" : PROPVALUE | STRINGVAL -> >\" symbols \".         else if((this.state == JsParserState.AWAIT_PROPS || this.state == JsParserState.AWAIT_STRVALUE) &amp;&amp; c != '\\\"')             err(c, \"\\\"\");         else if(this.state == JsParserState.AWAIT_PROPS){ \/\/ state == AWAIT_PROPS, c == '\"' [ trans_from(Start, '{') ]              c = getFilech(r); \/\/read character directly from file.             int l = 0;             while(c != '\\\"' &amp;&amp; bufp &lt; bsize) { \/\/read all content until '\"' char (end of the string) while buffer available.                 if(c == '\\\\')                     c = getEscaped(r);                 l++;                 buf[bufp++] = (char)c;                 c = getFilech(r);             }             if(bufp >= bsize &amp;&amp; c != '\\\"') { \/\/too long string (buffer exceeded)                 err(c, \"available space for \\'\"+(char)c +\"'\\' or EOL (\\\") symbol\");                 return;             }             props.push(new String(buf, 0, l));             flushBuf();             this.state = JsParserState.READ_PROPNAME;         }         else if(this.state == JsParserState.AWAIT_STRVALUE){             c = getFilech(r); \/\/read character.             int l = 0;             while(c != '\\\"' &amp;&amp; bufp &lt; bsize) {                 if(c == '\\\\')                     c = getEscaped(r);                 l++;                 buf[bufp++] = (char)c;                 c = getFilech(r);             }             if(bufp >= bsize &amp;&amp; c != '\\\"') {                 err(c, \"available space for \\'\"+(char)c +\"'\\' or EOL (\\\") symbol\");                 return;             }              this.state = JsParserState.READ_STRVALUE;             this.curVal = new JsonString(new String(buf, 0, l));             flushBuf();         }         else if(this.state == JsParserState.READ_PROPNAME &amp;&amp; c != ':')             err(c,\":\");         else if(this.state == JsParserState.READ_PROPNAME){ \/\/ c == ':' name value separator was read.             this.state = JsParserState.COLON;         }           else if(this.state == JsParserState.EMPTY_OR_NOT_ARR &amp;&amp; c == ']' &amp;&amp; ungetch(']') == 0){             err(']', \"available space for ']' but OutOfMemory!\");         }         else if(this.state == JsParserState.EMPTY_OR_NOT_ARR &amp;&amp; c == ']'){ \/\/ side effect from previous else if [ungetch() call!]             this.state = JsParserState.NEXT_VALUE;         }         else if(this.state == JsParserState.EMPTY_OR_NOT_ARR &amp;&amp; ungetch((char) c) == 0){ \/\/ c != ']'             err(c, \"available space for '\"+(char)c+\"' but OutOfMemory!\");         }         else if(this.state == JsParserState.EMPTY_OR_NOT_ARR){             this.state = JsParserState.COLON;         }          \/\/FIRST SYMBOL OF VALUE (AFTER SEPARATOR)         else if(this.state == JsParserState.COLON){             \/\/System.out.println(\"Property: \"+props.top()+ \" symbol \\'\"+(char)c+\"\\'\");             switch (c){                 case '\\\"':{                     this.state = JsParserState.AWAIT_STRVALUE;                     if( ungetch((char) c) == 0)                         err(c, \"available space but OutOfMemory!\");                     break;                 }                 case '{':{                     this.state = JsParserState.START;                     if(ungetch((char) c) == 0)                         err(c, \"available space but OutOfMemory!\");                     break;                 }                 case '[': {                     J_ARR.push(new JsonArray());                     J_ROOTS.push(J_ARR.top());                     this.state = JsParserState.EMPTY_OR_NOT_ARR;                     break;                 }                 default: {                     int l = 0;                      \/\/CHECK that rvalue is not consists of token symbols ( ']' '}' ',' ':' '[' '{', EOF)                     while(bufp &lt; bsize &amp;&amp; (c != ' ' &amp;&amp; c != '\\n' &amp;&amp; c != '\\r' &amp;&amp; c != '\\t')                         &amp;&amp; (c != '}' &amp;&amp; c != ']' &amp;&amp; c != ',' &amp;&amp; c != ':' &amp;&amp; c != '{'  &amp;&amp; c != '[' &amp;&amp; c != 65535)                     )                     { \/\/read all content til first space symbol ' '                         buf[bufp++] = (char)c;                         c = getFilech(r);                         l++;                     }                     if(bufp >= bsize &amp;&amp; (c != ' ' &amp;&amp; c != '\\n' &amp;&amp; c != '\\r' &amp;&amp; c != '\\t')                             &amp;&amp; (c != '}' &amp;&amp; c != ']' &amp;&amp; c != ',' &amp;&amp; c != ':' &amp;&amp; c != '{' &amp;&amp; c != '[' &amp;&amp; c != 65535)                     )                     {                         err(c, \"end of the token (space symbol or LF or CR or tab) or another token ('}' ']' etc.) but \\\"...\"+(char)c+\"\\\"\");                         return;                     }                     String v = new String(buf, 0, l);                     flushBuf();                     if(v.equals(\"null\"))                         this.curVal = new JsonNull();                     else if(v.equals(\"false\"))                         this.curVal = new JsonBoolean('f');                     else if(v.equals(\"true\"))                         this.curVal = new JsonBoolean('t');                     else {                        double val = ProcessNumber.parseNumber(v);                        if(Double.isNaN(val)) \/\/ NaN (Not a Number) tokens are invalid.                            err(c, \"a number token but found NaN \\\"\"+v+\"\\\"\");                        else if(Math.floor(val) == val)                            this.curVal = new JsonNumber((long) val);                        else                            this.curVal = new JsonRealNumber(val);                     }                     this.state = JsParserState.READ_STRVALUE;                     if(ungetch((char) c) == 0)                         err(c, \"available space but OutOfMemory!\");                     break;                 } \/\/ END of default.             } \/\/END of switch         }\/\/ END COLON state.          \/\/BEGIN READ_STRVALUE state. (READ_NON_EMPTY_VALUE)         \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438.         else if(this.state == JsParserState.READ_STRVALUE){             cur_obj = J_OBJS.top();             JsonArray cur_arr = null;             if(c == ',' &amp;&amp; J_ROOTS.top() instanceof JsonArray){                 cur_arr = J_ARR.top();                 cur_arr.getElements().add(this.curVal);\/\/ add new item to array                 this.state = JsParserState.COLON; \/\/awaiting new value                 this.curVal = null;             }             else if(c == ',' &amp;&amp; J_ROOTS.top() instanceof JsonObject){                 cur_obj.getValue().put(props.top(), this.curVal);\/\/add new pair prop : value to the object.                 props.pop();                 this.state = JsParserState.AWAIT_PROPS;\/\/awaiting new property                 this.curVal = null;             }             else if(c == ']' &amp;&amp; J_ROOTS.top() instanceof JsonArray){ \/\/after processed value follows ']'                 cur_arr = J_ARR.top();                 cur_arr.getElements().add(this.curVal);\/\/ add processed value to processed array.                 J_ARR.pop(); \/\/ remove processed array.                 J_ROOTS.pop();\/\/ and update root.                 this.curVal = null;                 if(J_ROOTS.top() instanceof JsonArray){                     J_ARR.top().getElements().add(cur_arr); \/\/add array as item                 }                 else if(J_ROOTS.top() instanceof JsonObject){                     J_OBJS.top().getValue().put(props.top(), cur_arr);\/\/ add array as property.                     props.pop();                 }                 this.state = JsParserState.NEXT_VALUE;             }             else if(c == '}'){ \/\/after processed value follows '}'                 cur_obj.getValue().put(props.top(), this.curVal);                 props.pop();                 this.curVal = null;                 if(J_OBJS.size() == 1) \/\/ root object finished.                     this.state = JsParserState.CLOSEROOT; \/\/ set final state to exit from cycle.                 else{                     J_OBJS.pop();\/\/remove processed object.                     J_ROOTS.pop();\/\/and update root.                     if(J_ROOTS.top() instanceof JsonArray){                         J_ARR.top().getElements().add(cur_obj);                     }                     else if(J_ROOTS.top() instanceof JsonObject){                         J_OBJS.top().getValue().put(props.top(), cur_obj);                         props.pop();                     }                     this.state = JsParserState.NEXT_VALUE;                 }             }             else                 err(c, \"one of ',' '}' ']' \");         } \/\/END READ_STRVALUE          \/\/BEGIN NEXT_VALUE state         else if(this.state == JsParserState.NEXT_VALUE){             cur_obj = J_OBJS.top();             if(c == ',' &amp;&amp; J_ROOTS.top() instanceof JsonArray){                 this.state = JsParserState.COLON;             }             else if(c == ',' &amp;&amp; J_ROOTS.top() instanceof JsonObject){                 this.state = JsParserState.AWAIT_PROPS;             }             else if(c == ']' &amp;&amp; J_ROOTS.top() instanceof JsonArray){                 JsonArray cur_arr = J_ARR.top();                 J_ARR.pop(); \/\/ remove processed array.                 J_ROOTS.pop();\/\/ and update root.                 if(J_ROOTS.top() instanceof JsonArray){                     J_ARR.top().getElements().add(cur_arr); \/\/add array as item                 }                 else if(J_ROOTS.top() instanceof JsonObject){                     J_OBJS.top().getValue().put(props.top(), cur_arr);\/\/ add array as property.                     props.pop();                 }                 this.state = JsParserState.NEXT_VALUE;             }             else if(c == '}'){                 cur_obj = J_OBJS.top();                 if(J_OBJS.size() == 1) \/\/ root object finished.                     this.state = JsParserState.CLOSEROOT; \/\/ set final state to exit from cycle.                 else{                     J_OBJS.pop();\/\/remove processed object.                     J_ROOTS.pop();\/\/and update root.                     if(J_ROOTS.top() instanceof JsonArray){                         J_ARR.top().getElements().add(cur_obj);                     }                     else if(J_ROOTS.top() instanceof JsonObject){                         J_OBJS.top().getValue().put(props.top(), cur_obj);                         props.pop();                     }                     this.state = JsParserState.NEXT_VALUE;                 }             }             else                 err(c, \"one of ',' '}' ']' \");          } \/\/ END NEXT_VALUE     }      \/\/\u0421\u0438\u0433\u043d\u0430\u043b \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.     private void err(int act, String msg){         state = JsParserState.ERR;         System.out.println(\"Founded illegal symbol \\'\" + (char)act + \"\\'\" +                 \" at (\"+line+\":\"+col+\"). Expected: \"+msg);     }      private int ungetch(char c){         if(bufp >= bsize){             System.out.println(\"Error (\"+line+\":\"+col+\"). ungetch(): too many characters.\");             return 0;         }         else{             buf[bufp++] = c;             return 1;         }     }      private int getch(InputStreamReader r) throws IOException {         if(bufp > 0)             return buf[--bufp];         else{             col++;             int c = r.read();             if(c == '\\n'){                 line++; col = 0;             }             else                 col += 1;             return c;         }     }      \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.     private int getEscaped(InputStreamReader r) throws IOException {         col++;         char x = (char)r.read();         switch (x){             case 't':{                 col++;                 return '\\t';             }             case 'r':{                 col++;                 return '\\r';             }             case 'n':{                 col++;                 return '\\n';             }             case 'f':{                 col++;                 return '\\f';             }             case 'b':{                 col++;                 return '\\b';             }             case '\\'':{                 col++;                 return '\\'';             }             case '\\\"':{                 col++;                 return '\\\"';             }             case '\\\\':{                 col++;                 return '\\\\';             }             case 'u':{                 col++;                 int i = 0;                 char[] hcode = new char[4];                 while(i &lt; 4 &amp;&amp; ( ((x = (char) r.read()) >= '0' &amp;&amp; x &lt;='9') || (x >= 'A' &amp;&amp; x &lt;= 'F') || (x >= 'a' &amp;&amp; x &lt;= 'f') )){                     hcode[i] = x;                     i++;                 }                 if(i &lt; 4) {                     err(x, \"Unicode token \\\\uxxxx where x one of [0-9] or [A-Fa-f]\");                     return 0;                 }                 int code = (int)ProcessNumber.parse(new String(hcode),null,'N',16,1, 1); \/\/just parse positive hex number to decimal.                 return code;             }             default:{                 ungetch(x);                 return '\\\\';             }         }     }      \/\/\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e     private int getFilech(InputStreamReader r) throws IOException {         int c = r.read();         if(c == '\\n'){ \/\/\u0443\u0432\u0435\u043b\u0447\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0441\u0442\u0440\u043e\u043a.             line += 1;             col = 0;         }         else{             col += 1;         }         return c;     }<\/code><\/pre>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041c\u0435\u0442\u043e\u0434\u044b <em>getch<\/em> \u0438 <em>ungetch(c) <\/em>\u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u0441 \u0432 \u0431\u0443\u0444\u0435\u0440<em>. <\/em>\u041c\u0435\u0442\u043e\u0434 <em>getFilech<\/em> \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 \u0444\u0430\u0439\u043b\u0430. \u0410 \u043c\u0435\u0442\u043e\u0434 <em>getEscaped<\/em> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0431\u044b\u043b\u0430 \u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (\\n, \\r, \\t) \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0435\u0439 \u0441\u0438\u043c\u0432\u043e\u043b. \u041c\u0435\u0442\u043e\u0434 <em>err<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043f\u0430\u0440\u0441\u0435\u0440\u0443 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0447\u0438\u0441\u0435\u043b \u0437\u0430\u043d\u044f\u0442 ProcessNumber, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/575456\/\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0412 <em>iterate<\/em> \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u0430\u0440\u0441\u0435\u0440\u0430. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u0441\u0438\u043c\u0432\u043e\u043b (\u0441 \u0431\u0443\u0444\u0435\u0440\u0430 \u0438\u043b\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430 \u0435\u0441\u043b\u0438 \u0431\u0443\u0444\u0435\u0440 \u043f\u0443\u0441\u0442), \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f START. \u0423\u0431\u0435\u0434\u0438\u0432\u0448\u0438\u0441\u044c, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0443\u044e\u0441\u044f \u0444\u0438\u0433\u0443\u0440\u043d\u0443\u044e \u0441\u043a\u043e\u0431\u043a\u0443, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0441\u0442\u044d\u043a\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0436\u0434\u0451\u043c \u043b\u0438\u0431\u043e \u043d\u0430\u0447\u0430\u043b\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (\u0442.\u043a. \u0438\u043c\u0435\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u0442\u043e \u0436\u0434\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438), \u043b\u0438\u0431\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u0443\u044e \u0444\u0438\u0433\u0443\u0440\u043d\u0443\u044e \u0441\u043a\u043e\u0431\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 AWAIT_PROPS_OR_END_OF_OBJ. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043a\u043e\u0431\u043a\u0430, \u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 NEXT_VALUE, \u0433\u0434\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0418\u043d\u0430\u0447\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 AWAIT_PROPS, \u0447\u0438\u0442\u0430\u044f \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043c \u0434\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0432 \u0431\u0443\u0444\u0435\u0440. \u0415\u0441\u043b\u0438 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 &#8212; \u043e\u0448\u0438\u0431\u043a\u0430 &#8212; \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u0434\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 (\u043e\u0447\u0438\u0449\u0430\u044f \u0435\u0433\u043e), \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 READ_PROPNAME. \u0412 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 READ_PROPNAME \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0438\u043c\u044f \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435\u043c &#171;:&#187;, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0432, \u0438\u0434\u0451\u043c \u0432 COLON, \u0433\u0434\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u0447\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8212; \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0447\u0438\u0441\u043b\u043e\u043c, \u0431\u0443\u043b\u0435\u0432\u044b\u043c \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u043c \u0438\u043b\u0438 <strong>null<\/strong>. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430, \u0442\u043e \u0438\u0434\u0451\u043c \u0432 AWAIT_STRVALUE \u0438 \u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043a\u0430\u043a \u0432 AWAIT_PROPS. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u0441\u0442\u0440\u043e\u043a\u0443, \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0435\u0451 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 READ_STRVALUE, \u0433\u0434\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0432 \u0447\u0438\u0441\u043b\u043e, \u0431\u0443\u043b\u0435\u0432-\u043b\u0438\u0442\u0435\u0440\u0430\u043b, <strong>null<\/strong>, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0442\u0443\u0434\u0430 \u0436\u0435 (\u0432 READ_STRVALUE). \u0412 READ_STRVALUE \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0437\u0430\u043f\u044f\u0442\u0430\u044f, \u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u044d\u043a \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0448\u0438\u043d J_ROOTS, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043b\u0438\u0431\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 J_ARRS, \u043b\u0438\u0431\u043e \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 J_OBJS (\u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435). \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043a\u043e\u0431\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442, \u0442\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u044d\u043a\u043e\u0432 \u0437\u0430\u043f\u0438\u0441\u044c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c J_ROOTS, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0444\u0438\u0433\u0443\u0440\u043d\u0443\u044e \u0441\u043a\u043e\u0431\u043a\u0443 (&#171;}&#187;) \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 CLOSEROOT, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0435\u0440\u0435\u0434 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0446\u0438\u043a\u043b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u043c\u044b \u0438\u0434\u0451\u043c \u043b\u0438\u0431\u043e \u0432 AWAIT_PROPS (\u043e\u0431\u044a\u0435\u043a\u0442), \u043b\u0438\u0431\u043e \u0432 COLON (\u043c\u0430\u0441\u0441\u0438\u0432). \u043b\u0438\u0431\u043e \u0432 NEXT_VALUE (\u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430\/\u043c\u0430\u0441\u0441\u0438\u0432\u0430).<\/p>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>\u041f\u0430\u0440\u0441\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u044f\u0432\u043d\u043e 4 \u0441\u0442\u044d\u043a\u0430, \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e, \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0443\u0444\u0435\u0440 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041f\u0430\u0440\u0441\u0435\u0440 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0431\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b. \u041f\u0430\u0440\u0441\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<\/p>\n<p>\u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, API \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u043d\u0435 \u043c\u0430\u0441\u0441\u0438\u0432, \u0442\u043e \u0434\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043b\u0438\u0431\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442, \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c  \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u043f\u0430\u0440\u0441\u0435\u0440.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/659287\/\"> https:\/\/habr.com\/ru\/post\/659287\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0412\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 JSON-\u043f\u0430\u0440\u0441\u0435\u0440 (\u0441 <s>\u0436\u0443\u043a\u0430\u043c\u0438 \u0438<\/s> \u0444\u0438\u0447\u0430\u043c\u0438). \u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 <em>well-formed<\/em> JSON-\u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c JSON-\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442. <strong>JSON-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/strong> &#8212; \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043d\u0435\u0443\u043a\u043e\u0441\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0438 \u044f\u0437\u044b\u043a\u0430.  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a \u0438 RFC, \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON. \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc8259\" rel=\"noopener noreferrer nofollow\">RFC 8259<\/a>. <\/p>\n<h3>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f <\/h3>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0433\u0443\u0433\u043b\u043e\u0432\u0441\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 JSON \u0442\u0435\u043a\u0441\u0442\u0430. <\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439, <s>\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439<\/s>  \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API \u0441 \u0431\u043e\u0433\u0430\u0442\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0432\u0435\u0449\u0435\u0439.<\/p>\n<p>\u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0441\u0442\u044c. \u0412\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0441\u0432\u043e\u0451 \u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435.<\/p>\n<h2>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b JSON.<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0432\u0437\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u0448 \u043f\u0430\u0440\u0441\u0435\u0440? \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 JSON-\u0444\u043e\u0440\u043c\u0430\u0442\u0443?&#187; \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 JSON, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u043e\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u0443\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c? \u0422\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u0411\u0443\u0434\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a RFC. \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u0435\u0441\u0442\u044c 4 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0438 2 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0445 (\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b). \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043d\u0435-\u0441\u0442\u0440\u0443\u043a\u0442\u0440\u0443\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c  \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430. \u0412\u0441\u0435 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <em>JsonElement<\/em>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 JSON-\u0435.<\/p>\n<pre><code class=\"java\">public abstract class JsonElement&lt;T> { \/\/T - \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 JSON.     public abstract T getValue(); \/\/\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435.    \/\/\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f     @Override     public String toString(){         return getValue().toString();      }  }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 JsonElement \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0435\u0433\u043e \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u043a\u0443, \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <em>getValue<\/em>.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0431\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (<strong>boolean<\/strong>). \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441 JsonBoolean \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 \u043e\u0442 JsonElement&lt;Boolean>.<\/p>\n<pre><code class=\"java\">public class JsonBoolean extends JsonElement&lt;Boolean> { \/\/\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 - Boolean      private boolean v;        \/\/\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e = false.     public JsonBoolean(){       this.v = false;     }        \/\/\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430.   public JsonBoolean(Boolean b){      this.v = b;      }        \/\/\u041c\u043d\u0435\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.     \/\/t = true (t stands for true). \u041a\u0430\u043a \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435.     \/\/other = false. (\u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u0440\u043e\u043c\u0435 't').     public JsonBoolean(Character c){         this.v = (c == 't');     }      @Override     public Boolean getValue() {         return v;     }  }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (Number). \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0432 JSON \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0442\u0430\u043a \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439. \u0414\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043e\u0442 \u0447\u0438\u0441\u0435\u043b \u0441 \u0442\u043e\u0447\u043a\u043e\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <em>JsonNumber<\/em> \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430. \u0415\u0433\u043e \u043a\u043e\u0434 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u0441\u0445\u0435\u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"java\">public class JsonNumber extends JsonElement&lt;Number> { \/\/ \u0427\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0442\u0438\u043f - Number.      private Number n;      \/\/\u041d\u0435 \u0437\u043d\u0430\u0435\u043c \u0442\u043e\u0447\u043d\u043e, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 Number.     public JsonNumber(Number n){         this.n = n;     }        @Override     public Number getValue() {         return n;     } }<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0436\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, JsonRealNumber \u0435\u0449\u0451 \u043f\u0440\u043e\u0449\u0435:<\/p>\n<pre><code class=\"java\">public class JsonRealNumber extends JsonNumber { \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f JsonNumber.      \/\/\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439.     \/\/Float \u0438\u043b\u0438 Double.     public JsonRealNumber(Float n){          super(n);     }     public JsonRealNumber(Double n) {         super(n);     } }<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f <em>JsonString<\/em> \u0438 \u0442\u0438\u043f <em>JsonNull<\/em> \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <strong>null <\/strong>(\u0434\u0430, \u0434\u043b\u044f null &#8212; \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0430\u0436 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441.). \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<pre><code class=\"java\">public class JsonString extends JsonElement&lt;String> {          private String val;     public JsonString(String v){         this.val = v;     }      @Override     public String getValue() {         return val;     }      \/\/ \u041d\u0435 \u043d\u0430\u0434\u043e \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c getValue(), \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430.     @Override     public String toString(){         return val;     } }  \/\/\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 JsonNull.java public class JsonNull extends JsonElement&lt;String> {     @Override     public String getValue() {         return \"null\";  \/\/\u041f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \"null\"     } }<\/code><\/pre>\n<p>\u041e\u0431\u044a\u044f\u0441\u043d\u0438\u043c \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 <strong>getValue()<\/strong> \u0443 \u0442\u0438\u043f\u0430 <em>JsonNull<\/em>. \u041a\u0430\u043a \u0412\u044b \u0443\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 <strong>&#171;null&#187;<\/strong> \u0442\u0438\u043f\u0430 JsonString \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c  \u0442\u0438\u043f\u0430 JsonNull. \u041e\u0442\u043b\u0438\u0447\u0438\u0442\u044c \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 JsonNull.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u043c \u0442\u0438\u043f\u0430\u043c. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 &#8212; \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 <em>JsonElement<\/em>. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b, \u043a\u043b\u0430\u0441\u0441 <em>JsonArray <\/em>(\u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430), \u043b\u0438\u0448\u044c \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 ArrayList&lt;JsonElement>. \u0415\u0433\u043e \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0434\u0430\u043b\u0435\u0435.<\/p>\n<pre><code class=\"java\">\/* JsonArray - \u043a\u0430\u043a List of JsonElements. *\/ public class JsonArray extends JsonElement&lt;List&lt;JsonElement>> {     private List&lt;JsonElement> elements;     private int c; \/\/ 'c' stands for count (\u0447\u0438\u0441\u043b\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432).     private String pName; \/\/ \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d.      public JsonArray(){         this.elements = new ArrayList&lt;>();         this.c = 0;         this.pName = null;     }      public JsonArray(List&lt;JsonElement> elements){         this.elements = elements;         this.c = elements.size();         this.pName = null;     }      \/\/\u041c\u0435\u043d\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 (\u041d\u0415 addElements)!     public void setElements(List&lt;JsonElement> elements) {         this.elements = elements;     }      public &lt;T> void add(JsonElement&lt;T> e){         elements.add(e);         c++;     }      public void setPropertyName(String pName) {         this.pName = pName;     }      public String getPropertyName(){         return pName;     }      public ArrayList&lt;JsonElement> getElements() {         return elements;     }      \/\/getCount().     public int getC() {         return c;     }      @Override     public List&lt;JsonElement> getValue() {         return elements;     }<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u0438\u043f &#8212; \u043e\u0431\u044a\u0435\u043a\u0442\u044b JSON. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430  \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0430\u0440\u044b \u00ab\u0438\u043c\u044f-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb, \u0433\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c (\u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432), \u043b\u0438\u0431\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u043b\u0438\u0441\u044c \u0432\u044b\u0448\u0435. \u0418\u043c\u0435\u043d\u0430 &#8212; \u0441\u0443\u0442\u044c \u043a\u043b\u044e\u0447\u0438. \u0422\u0438\u043f \u043a\u043b\u044e\u0447\u0435\u0439 &#8212; \u0441\u0442\u0440\u043e\u043a\u0430. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u0430\u0440, \u0438 \u0438\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d (\u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u0442.\u0434.).<\/p>\n<pre><code class=\"java\">\/* LinkedHashMap - \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.   \u041d\u0443\u0436\u043d\u0430\u044f \u0432\u0435\u0449\u044c, \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0435 \u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440.    TKey = String. (\u0422\u0438\u043f \u043a\u043b\u044e\u0447\u0430 - \u0441\u0442\u0440\u043e\u043a\u0438).    TValue - V. (\u041f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439). *\/ public class StrLinkedHashMap&lt;V> extends LinkedHashMap&lt;String, V> {        \/\/\u041c\u0435\u0442\u043e\u0434, \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0443 \u043f\u0430\u0440.     @Override     public String toString(){         Set&lt;String> keys = keySet();                \/\/\u041d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438.         \/\/(\u041d\u0435\u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0435\u043d! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 StringBuffer)         StringBuilder sb = new StringBuilder();                sb.append(\"{\\n\\t\"); \/\/ \u0438\u043c\u0435\u043d\u0430 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438.                  Iterator&lt;String> t = keySet().iterator();         while(t.hasNext()){             String k = t.next();             sb.append(k+\" : \"+get(k).toString());             if(t.hasNext())                 sb.append(\",\\n\\t\");         }         sb.append(\"}\");         return sb.toString();     } }<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430-\u043e\u0431\u044a\u0435\u043a\u0442\u0430 JSON. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c JSON-\u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <em>JsonObject<\/em>.<\/p>\n<pre><code class=\"java\">public class JsonObject extends JsonElement&lt;StrLinkedHashMap&lt;JsonElement>> {     private StrLinkedHashMap&lt;JsonElement> table; \/\/ \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435      public JsonObject(){         this.table = new StrLinkedHashMap&lt;>();     }      public void Put(String k, JsonElement id){         this.table.put(k,id);     }      \/\/inherits from LinkedHashMap.     \/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0443.     \/\/ \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430.     \/\/ \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043f\u0430\u0440, \u043f\u043e \u043a\u043b\u044e\u0447\u0443 k.     \/\/ \u041d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 (\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438).     public JsonElement Get(String k){\/\/get element on the root level.         return table.get(k);     }            \/\/\u0421\u0438\u043d\u043e\u043d\u0438\u043c \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 Get(String k).     public JsonElement getProperty(String pname){         return table.get(pname);     }      \/\/get Element by path using path dot notation.     \/\/ \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438.     public JsonElement getElement(String path){         ArrayList&lt;String> p = new ArrayList&lt;>();                \/\/\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0441\u043b\u043e\u0432\u0430 \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e \u0442\u043e\u0447\u043a\u0430 '.'         Pattern regex = Pattern.compile(\"\\\\w([^.]*)\");          Matcher m = regex.matcher(path);          while(m.find())             p.add(m.group());         StrLinkedHashMap&lt;JsonElement> cnode = table;\/\/ROOT. \u041a\u043e\u0440\u0435\u043d\u044c.         JsonElement n  = null;                \/\/\u0415\u0441\u043b\u0438 \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0431\u0435\u0437 \u0442\u043e\u0447\u0435\u043a -> \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e.         if(p.size() == 0)              return getProperty(path);                \/\/ \u0414\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0432\u0433\u043b\u0443\u0431\u044c, \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \"A.B.C\"         for(String c : p){             n = cnode.get(c);                         if(n == null) \/\/\u041d\u0438\u0447\u0435\u0433\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0442 (\u0434\u0430\u0436\u0435 null \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438)                 return n; \/\/ \u0431\u0443\u0434\u0435\u0442 null \u0432 \u043a\u043e\u0434\u0435.                        try {\/\/is interior node                 \/\/cnode - \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438.                 \/\/ \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0442\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e.                 cnode = (StrLinkedHashMap&lt;JsonElement>) n.getValue(); \/\/ isTable.             }catch (ClassCastException e){\/\/that was leaf. (\u043d\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0442\u0438\u043f).                 return cnode.get(c); \/\/\u0418\u0437\u0432\u043b\u0435\u0447\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.             }         }         return n;     }      \/\/\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 - \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043f\u0430\u0440 \"\u0438\u043c\u044f\" : \"\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\".     @Override     public StrLinkedHashMap&lt;JsonElement> getValue() {         return table;     }      \/\/\u041d\u0435\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e, \u044f\u0432\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u044d\u043a\u0430, \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0432\u0441\u0451 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435,     \/\/\u0432\u043a\u043b\u044e\u0447\u0430\u044f<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-331551","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=331551"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331551\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}