{"id":258789,"date":"2015-06-06T15:01:01","date_gmt":"2015-06-06T11:01:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=258789"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=258789","title":{"rendered":"\u0411\u0438\u0442\u0432\u0430 \u00ab\u0421\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c vs \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c\u00bb \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u043e\u043d\u0435 antlr4"},"content":{"rendered":"<p>     \t\u041f\u043e\u0441\u0435\u0449\u0430\u0442\u044c \u0438\u043b\u0438 \u0441\u043b\u0443\u0448\u0430\u0442\u044c? \u0414\u0435\u043b\u043e \u0432\u043a\u0443\u0441\u0430 \u2013 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435. \u0418\u043b\u0438 \u043d\u0435\u0442?<br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/259475\/\">\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/a><br \/>  \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u0435\u0440\u0435\u0432\u043e<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/330\/19a\/102\/33019a102c144652a211692f590eb98b.png\" alt=\"image\"\/><br \/>  \u0421\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438 \u043a\u0430\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u043e\u043d\u043e \u201c\u0414\u0435\u0440\u0435\u0432\u044f\u043d\u043d\u043e\u0435\u201d, \u0441\u043c\u044b\u0441\u043b\u043e\u043c \u0438 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 (\u043e\u0431\u0445\u043e\u0434\u0430) \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430. \u0414\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u043d\u0435 \u0433\u043e\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u044f\u0433\u0430\u0442\u044c\u0441\u044f \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0435 \u0441\u0430\u043d\u0438 \u043f\u043e \u0441\u043f\u0443\u0441\u043a\u0443 \u0441 \u0434\u0435\u0440\u0435\u0432\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0435\u043d\u044f) \u0432 antlr4 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e.   <\/p>\n<h4>1. Visitor<\/h4>\n<p>  \u041a\u043b\u0430\u0441\u0441\u0438\u043a\u0430 \u2014 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u0440\u0438 \u043e\u0431\u0445\u043e\u0434\u0435 \u0443\u0437\u043b\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0442\u0438\u043f \u0443\u0437\u043b\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0432\u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430.  <\/p>\n<h4>2. Listener<\/h4>\n<p>  \u041d\u043e\u0432\u0448\u0435\u0441\u0442\u0432\u043e, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u0432 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0443\u0436\u0435 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 (Observer \u0438\u043b\u0438 Publish\/Subscribe). \u0412 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043e \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0430. \u0418\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0443\u0437\u043b\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043a\u0443 \u201c\u042f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e \u0425 \u0443\u0437\u0435\u043b\u201d, \u0434\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u043e\u0431\u0445\u043e\u0434 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u0443\u0437\u043b\u0430, \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0445\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u201c\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043e\u0431\u0445\u043e\u0434\u0430 \u0443\u0437\u043b\u0430 \u0425\u201d.<a name=\"habracut\"><\/a>   <\/p>\n<h4>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u0430\u0432\u0442\u043e\u0440\u0443 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044f <a href=\"https:\/\/pragprog.com\/book\/tpantlr2\/the-definitive-antlr-4-reference\">pragprog.com\/book\/tpantlr2\/the-definitive-antlr-4-reference<\/a>. \u0412 \u043a\u043d\u0438\u0433\u0435 <b>\u201cThe Definitive ANTLR 4 Reference\u201d<\/b> \u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <b>8.2 Translating JSON to XML<\/b> \u0430\u0432\u0442\u043e\u0440 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Listener.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0432 \u043a\u043d\u0438\u0433\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 JAVA, \u044f \u0441 JAVA \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c, \u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 C# \u0431\u0435\u0437 \u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e (\u0432\u043e\u0442 \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 best practice).<br \/>  \u0414\u043b\u044f \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f <b>VS, C# proj \u0438 JASON.g4 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c<\/b>  <\/p>\n<pre><code class=\"cs\">grammar JASON;  json: object \t| array \t;  object \t: '{' pair ( ',' pair )* '}'\t# AnObject \t| '{' '}'\t\t\t\t\t\t# EmptyObject \t;  \tpair: STRING':'value;  array \t: '['value(','value)*']'\t# ArrayOfValues \t| '['']'\t\t\t\t\t# EmptyArray \t;  value \t: STRING\t# String \t| NUMBER\t# Atom \t| object\t# ObjectValue \t| array\t# ArrayValue \t| 'true'\t# Atom \t| 'false'\t# Atom \t| 'null'\t# Atom \t;  STRING \t: '&quot;' ( ESC | ~[&quot;\\\\] )* '&quot;';  \tfragment ESC: '\\\\'([&quot;\\\\\/bfnrt]|UNICODE); \tfragment UNICODE:'u'HEX HEX HEX HEX; \tfragment HEX:[0-9a-fA-F];  NUMBER \t: '-'? INT'.'INT EXP? \/\/1.35,1.35E-9,0.3,-4.5 \t| '-'? INT EXP \/\/1e10-3e4 \t| '-'? INT \/\/-3,45 \t;  \tfragment INT: '0'|[1-9][0-9]*;\/\/noleadingzeros \tfragment EXP: [Ee][+\\-]? INT;\/\/\\-since-means&quot;range&quot;inside[...]  WS : [\\t\\n\\r]+-&gt;skip;  <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c JASON. \u0412 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0444\u0430\u0439\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c Generate Listener \u0438 Generate Visitor (\u044d\u0442\u043e \u0435\u0449\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0421\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0437 \u043a\u043d\u0438\u0433\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442 xml, \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c XElement (\u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e xml \u0442\u0435\u043a\u0441\u0442 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e \u0447\u0442\u043e \u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c, \u0445\u043e\u0442\u044f \u043f\u043b\u044e\u0441 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0442\u043e\u043c \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0437\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u0432 \u0440\u0430\u043c\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432).<br \/>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u043e\u0441\u0442: \u0442\u043a antlr4 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u043a \u0443\u0437\u043b\u0430\u043c), \u0442\u043e xml \u0431\u0443\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0435\u0434\u043a\u0430 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u043a\u0438.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0421\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f  <\/p>\n<pre><code class=\"cs\">      class XmlListener : JASONBaseListener \t{ \t\t#region fields  \t\tParseTreeProperty&lt;XElement&gt; xml = new ParseTreeProperty&lt;XElement&gt;();  \t\t#endregion  \t\t#region result  \t\tpublic XElement Root { get; private set; }  \t\t#endregion  \t\t#region xml api  \t\tXElement GetXml( IParseTree ctx ) \t\t{ \t\t\treturn xml.Get( ctx ); \t\t}  \t\t\/\/\/ &lt;summary&gt; \t\t\/\/\/ \u043f\u043e\u0438\u0441\u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e xml \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \t\t\/\/\/ &lt;\/summary&gt; \t\tXElement GetParentXml( IParseTree ctx ) \t\t{ \t\t\tvar parent = ctx.Parent;  \t\t\tXElement result = GetXml( parent );  \t\t\tif ( result == null ) \t\t\t\tresult = GetParentXml( parent );  \t\t\treturn result; \t\t}  \t\tvoid SetXml( IParseTree ctx, XElement e ) \t\t{ \t\t\txml.Put( ctx, e ); \t\t}  \t\t#endregion  \t\t#region listener  \t\tpublic override void ExitString( JASONParser.StringContext context ) \t\t{ \t\t\tvar value = GetStringValue( context.STRING() );  \t\t\tAddValue( context, value ); \t\t}  \t\tpublic override void ExitAtom( JASONParser.AtomContext context ) \t\t{ \t\t\tvar value = context.GetText();  \t\t\tAddValue( context, value ); \t\t}  \t\tpublic override void EnterPair( JASONParser.PairContext context ) \t\t{ \t\t\tvar name = GetStringValue( context.STRING() ); \t\t\tXElement element = new XElement( name );  \t\t\tXElement ParentElement = GetParentXml( context );  \t\t\tParentElement.Add( element ); \t\t\tSetXml( context, element ); \t\t}  \t\tpublic override void EnterJson( JASONParser.JsonContext context ) \t\t{ \t\t\tRoot = new XElement( &quot;JSON&quot; ); \t\t\tSetXml( context, Root); \t\t}  \t\t#endregion  \t\t#region private  \t\tprivate string GetStringValue( ITerminalNode terminal ) \t\t{ \t\t\treturn terminal.GetText().Trim( '&quot;' ); \t\t}  \t\tprivate void AddValue( ANTLR_CSV.JASONParser.ValueContext context, string value ) \t\t{ \t\t\tvar parent = GetParentXml( context );  \t\t\tif ( context.Parent.RuleIndex == JASONParser.RULE_array ) \t\t\t{ \t\t\t\tXElement element = new XElement( &quot;elemnt&quot; ); \t\t\t\telement.Value = value;  \t\t\t\tparent.Add( element );  \t\t\t\tSetXml( context, element ); \t\t\t} \t\t\telse \t\t\t\tparent.Value = value; \t\t}  \t\t#endregion  \t}  <\/code><\/pre>\n<p>  EnterJson \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0445\u043e\u0434\u0443 \u0432 \u0443\u0437\u0435\u043b \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0435 \u0442\u0430\u043a   <\/p>\n<pre><code class=\"cs\">json: object \t| array \t; <\/code><\/pre>\n<p>  ExitString \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u044b\u0445\u043e\u0434\u0443 \u0438\u0437 \u0443\u0437\u043b\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0435 \u0442\u0430\u043a  <\/p>\n<pre><code class=\"cs\">STRING\t# String <\/code><\/pre>\n<p>  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u0435\u0439 Enter \u0438 Exit. \u0417\u0430 \u0442\u043e \u0435\u0441\u0442\u044c ParseTreeProperty \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u043d\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u044b [\u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u043e, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435], \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043b\u0443\u0447\u0448\u0435 \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c (\u0445\u0443\u0436\u0435 \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442).<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f  <\/p>\n<pre><code class=\"cs\">class XmlVisitor : JASONBaseVisitor&lt;XElement&gt; \t{ \t\t#region fields  \t\tprivate XElement _result;  \t\tParseTreeProperty&lt;XElement&gt; xml = new ParseTreeProperty&lt;XElement&gt;();  \t\t#endregion  \t\t#region xml api  \t\tXElement GetXml( IParseTree ctx ) \t\t{ \t\t\treturn xml.Get( ctx ); \t\t}  \t\tXElement GetParentXml( IParseTree ctx ) \t\t{ \t\t\tvar parent = ctx.Parent;  \t\t\tXElement result = GetXml( parent );  \t\t\tif ( result == null ) \t\t\t\tresult = GetParentXml( parent );  \t\t\treturn result; \t\t}  \t\tvoid SetXml( IParseTree ctx, XElement e ) \t\t{ \t\t\txml.Put( ctx, e ); \t\t}  \t\t#endregion  \t\t#region visitor  \t\t\/\/\/ &lt;summary&gt; \t\t\/\/\/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e xml \t\t\/\/\/ &lt;\/summary&gt; \t\tprotected override XElement DefaultResult { get { return _result; } }  \t\tpublic override XElement VisitJson( JASONParser.JsonContext context ) \t\t{ \t\t\t_result = new XElement( &quot;JSON&quot; ); \t\t\tSetXml( context, _result ); \t\t\treturn VisitChildren( context ); \t\t}  \t\tpublic override XElement VisitString( JASONParser.StringContext context ) \t\t{ \t\t\tvar value = GetStringValue( context.STRING() );  \t\t\tAddValue( context, value );  \t\t\treturn DefaultResult; \t\t}  \t\tpublic override XElement VisitAtom( JASONParser.AtomContext context ) \t\t{ \t\t\tvar value = context.GetText();  \t\t\tAddValue( context, value );  \t\t\treturn DefaultResult; \t\t}  \t\tpublic override XElement VisitPair( JASONParser.PairContext context ) \t\t{ \t\t\tvar name = GetStringValue( context.STRING() ); \t\t\tXElement element = new XElement( name );  \t\t\tXElement ParentElement = GetParentXml( context );  \t\t\tParentElement.Add( element ); \t\t\tSetXml( context, element );  \t\t\treturn VisitChildren( context ); \t\t}  \t\t#endregion  \t\t#region private  \t\tprivate string GetStringValue( ITerminalNode terminal ) \t\t{ \t\t\treturn terminal.GetText().Trim( '&quot;' ); \t\t}  \t\tprivate void AddValue( ANTLR_CSV.JASONParser.ValueContext context, string value ) \t\t{ \t\t\tvar parent = GetParentXml( context );  \t\t\tif ( context.Parent.RuleIndex == JASONParser.RULE_array ) \t\t\t{ \t\t\t\tXElement element = new XElement( &quot;elemnt&quot; ); \t\t\t\telement.Value = value;  \t\t\t\tparent.Add( element );  \t\t\t\tSetXml( context, element ); \t\t\t} \t\t\telse \t\t\t\tparent.Value = value; \t\t}  \t\t#endregion \t}  <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f \u201c\u041d\u0430\u0439\u0434\u0438\u0442\u0435 10 \u043e\u0442\u043b\u0438\u0447\u0438\u0439\u201d, \u043f\u0435\u0440\u0432\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 VisitJson, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0431\u0435\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 VisitChildren( context ) \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0438 \u043e\u0431\u0445\u043e\u0434. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f, \u0430 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e   <\/p>\n<pre><code class=\"cs\">var result = visitor.Visit( tree );  <\/code><\/pre>\n<p>  \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u043e \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u043c   <\/p>\n<pre><code class=\"cs\">walker.Walk( listener, tree ); var result = listener.Root; <\/code><\/pre>\n<p>  \u0412 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0435\u0437 \u0421\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u0443\u0433\u043e, \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043e\u0441\u043e\u0431\u043e \u043d\u0435\u0442, \u043d\u043e \u044f \u043e\u0442\u0434\u0430\u044e \u0441\u0432\u043e\u0439 \u0433\u043e\u043b\u043e\u0441 \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435.<br \/>  \u041d\u0443 \u0438 \u0447\u0442\u043e \u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438  <\/p>\n<pre><code class=\"cs\">    private static IParseTree CreateTree() \t\t{ \t\t\tStringBuilder sb = new StringBuilder();  \t\t\tsb.AppendLine( &quot;{&quot; ); \t\t\tsb.AppendLine( &quot;\\&quot;description\\&quot;:\\&quot;Animaginary server config file\\&quot;,&quot; ); \t\t\tsb.AppendLine( &quot;\\&quot;count\\&quot;:500,&quot; ); \t\t\tsb.AppendLine( &quot;\\&quot;logs\\&quot;:{\\&quot;level\\&quot;:\\&quot;verbose\\&quot;,\\&quot;dir\\&quot;:\\&quot;\/var\/log\\&quot;},&quot; ); \t\t\tsb.AppendLine( &quot;\\&quot;host\\&quot;:\\&quot;antlr.org\\&quot;,&quot; ); \t\t\tsb.AppendLine( &quot;\\&quot;admin\\&quot;:[\\&quot;parrt\\&quot;,\\&quot;tombu\\&quot;],&quot; ); \t\t\tsb.AppendLine( &quot;\\&quot;aliases\\&quot;:[]&quot; ); \t\t\tsb.AppendLine( &quot;}&quot; );   \t\t\tAntlrInputStream input = new AntlrInputStream( sb.ToString() ); \t\t\tJASONLexer lexer = new JASONLexer( input ); \t\t\tCommonTokenStream tokens = new CommonTokenStream( lexer ); \t\t\tJASONParser parser = new JASONParser( tokens ); \t\t\tIParseTree tree = parser.json(); \t\t\treturn tree; \t\t} <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 JSON \u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u0437\u044f\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430.  <\/p>\n<pre><code class=\"cs\">    private static void ListenerXml() \t\t{ \t\t\tIParseTree tree = CreateTree();  \t\t\tParseTreeWalker walker = new ParseTreeWalker(); \t\t\tXmlListener listener = new XmlListener(); \t\t\twalker.Walk( listener, tree ); \t\t\tvar result = listener.Root; \t\t}      private static void VisitorXml() \t\t{ \t\t\tIParseTree tree = CreateTree();  \t\t\tXmlVisitor visitor = new XmlVisitor(); \t\t\tvar result = visitor.Visit( tree ); \t\t}  <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f  <\/p>\n<pre><code class=\"xml\">&lt;JSON&gt;   &lt;description&gt;Animaginary server config file&lt;\/description&gt;   &lt;count&gt;500&lt;\/count&gt;   &lt;logs&gt;     &lt;level&gt;verbose&lt;\/level&gt;     &lt;dir&gt;\/var\/log&lt;\/dir&gt;   &lt;\/logs&gt;   &lt;host&gt;antlr.org&lt;\/host&gt;   &lt;admin&gt;     &lt;elemnt&gt;parrt&lt;\/elemnt&gt;     &lt;elemnt&gt;tombu&lt;\/elemnt&gt;   &lt;\/admin&gt;   &lt;aliases \/&gt; &lt;\/JSON&gt;   <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u043d\u043e \u043e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u044b\u0434\u0430\u043b\u0438 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435.<br \/>  P.S. \u0421\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c vs \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c \u2013 0: 1     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/259691\/\"> http:\/\/habrahabr.ru\/post\/259691\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u041f\u043e\u0441\u0435\u0449\u0430\u0442\u044c \u0438\u043b\u0438 \u0441\u043b\u0443\u0448\u0430\u0442\u044c? \u0414\u0435\u043b\u043e \u0432\u043a\u0443\u0441\u0430 \u2013 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435. \u0418\u043b\u0438 \u043d\u0435\u0442?<br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/259475\/\">\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/a><br \/>  \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u0435\u0440\u0435\u0432\u043e<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/330\/19a\/102\/33019a102c144652a211692f590eb98b.png\" alt=\"image\"\/><br \/>  \u0421\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438 \u043a\u0430\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u043e\u043d\u043e \u201c\u0414\u0435\u0440\u0435\u0432\u044f\u043d\u043d\u043e\u0435\u201d, \u0441\u043c\u044b\u0441\u043b\u043e\u043c \u0438 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 (\u043e\u0431\u0445\u043e\u0434\u0430) \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430. \u0414\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u043d\u0435 \u0433\u043e\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u044f\u0433\u0430\u0442\u044c\u0441\u044f \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0435 \u0441\u0430\u043d\u0438 \u043f\u043e \u0441\u043f\u0443\u0441\u043a\u0443 \u0441 \u0434\u0435\u0440\u0435\u0432\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0435\u043d\u044f) \u0432 antlr4 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e.   <\/p>\n<h4>1. Visitor<\/h4>\n<p>  \u041a\u043b\u0430\u0441\u0441\u0438\u043a\u0430 \u2014 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u0440\u0438 \u043e\u0431\u0445\u043e\u0434\u0435 \u0443\u0437\u043b\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0442\u0438\u043f \u0443\u0437\u043b\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0432\u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430.  <\/p>\n<h4>2. Listener<\/h4>\n<p>  \u041d\u043e\u0432\u0448\u0435\u0441\u0442\u0432\u043e, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u0432 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0443\u0436\u0435 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 (Observer \u0438\u043b\u0438 Publish\/Subscribe). \u0412 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043e \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0430. \u0418\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0443\u0437\u043b\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043a\u0443 \u201c\u042f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e \u0425 \u0443\u0437\u0435\u043b\u201d, \u0434\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u043e\u0431\u0445\u043e\u0434 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u0443\u0437\u043b\u0430, \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0445\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u201c\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043e\u0431\u0445\u043e\u0434\u0430 \u0443\u0437\u043b\u0430 \u0425\u201d.<\/p>\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-258789","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258789","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=258789"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258789\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}