{"id":5394,"date":"2021-12-11T20:24:01","date_gmt":"2021-12-11T12:24:01","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=5394"},"modified":"2021-12-11T20:24:02","modified_gmt":"2021-12-11T12:24:02","slug":"%e6%95%99%e7%a8%8b%e4%bd%bf%e7%94%a8-tqjsoninputchannel-%e6%9d%a5%e9%87%8d%e5%a4%8d%e8%8e%b7%e5%8f%96-json-%e5%af%b9%e8%b1%a1","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=5394","title":{"rendered":"[\u6559\u7a0b]\u4f7f\u7528 TQJsonInputChannel \u6765\u91cd\u590d\u83b7\u53d6 JSON \u5bf9\u8c61"},"content":{"rendered":"\n<p>TQJsonInputChannel \u662f QJson \u65b0\u589e\u7684\u5bf9\u8c61\uff0c\u76ee\u7684\u662f\u89e3\u51b3\u8fde\u7eed\u7684JSON\u5e8f\u5217\u8bfb\u53d6\u548c\u8d85\u957f\u7684JSON\u6570\u636e\u5185\u5bb9\u8bfb\u53d6\u5904\u7406\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u3010\u57fa\u672c\u6b65\u9aa4\u3011<\/p>\n\n\n\n<p>1\u3001\u6839\u636e\u6e90\u7684\u7f16\u7801\uff0c\u521b\u5efa\u5bf9\u5e94\u7684\u5e8f\u5217\u5bf9\u8c61\u5e76\u8bbe\u7f6e\u76f8\u5173\u4e8b\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var\n  AHelper:TQJsonInputChannel;\nbegin\n  AHelper:=TQJsonInputChannel.Create(teUtf8);\n  AHelper.OnJsonReady:=DoJsonReady;\n  AHelper.OnParseError:=DoParseError;<\/code><\/pre>\n\n\n\n<p>2\u3001\u4ece\u6e90\u4e2d\u8bfb\u53d6\u4e00\u5757\u6570\u636e\uff0c\u7136\u540e\u63a8\u5230  TQJsonInputChannel  \u5b9e\u4f8b\u4e2d\uff0c\u4e0d\u9700\u8981\u5173\u5fc3\u8bfb\u53d6\u7684\u5757\u662f\u5426\u5b8c\u6574\uff0cTQJsonInputChannel \u4f1a\u81ea\u52a8\u68c0\u67e5\uff0c\u5f53\u6536\u5230\u4e00\u4e2a\u5b8c\u6574\u7684 JSON \u6570\u636e\u65f6\uff0c\u4f1a\u89e6\u53d1 OnJsonReady \u4e8b\u4ef6\uff0c\u4f9b\u4e0a\u5c42\u5904\u7406\u3002\u6bd4\u5982\u4e0b\u9762\u7684\u4ee3\u7801\u662f\u6709\u6548\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  AHelper.Push('{\"name\"');\n  AHelper.Push(':100}');<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8ff0\u4ee3\u7801\u751f\u6210\u7684 JSON \u5bf9\u8c61\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\"name\":100}<\/code><\/pre>\n\n\n\n<p>\u3010\u793a\u4f8b1\uff1a\u4ece\u6d41\u4e2d\u52a0\u8f7d\u3011<\/p>\n\n\n\n<p>\u5047\u8bbe\u6d41\u4e2d\u5305\u542b\u4e0b\u9762\u7684JSON\u5e8f\u5217\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\"id\":1001,\"name\":\"qdac\"}{\"id\":1002,\"name\":\"projectZ\"}<\/code><\/pre>\n\n\n\n<p>\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u6d41\u5bf9\u8c61\uff0c\u4ece\u8fd9\u4e2a\u6d41\u4e2d\u8bfb\u53d6\u6570\u636e\uff0c\u5c31\u53ef\u4ee5\u89e6\u53d1\u4e24\u6b21 OnJsonReady\uff0c\u6536\u5230\u4e24\u4e2a JSON \u5e8f\u5217\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u662f\u4e0b\u9762\u683c\u5f0f\u7684 JSON\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5c06\u7b2c\u4e00\u4e2a\u5b57\u7b26\u8df3\u8fc7\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;{\"id\":1001,\"name\":\"qdac\"},{\"id\":1002,\"name\":\"projectZ\"}]<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u7684\u4ee3\u7801\u540c\u6837\u4f1a\u89e6\u53d1\u4e24\u6b21 OnJsonReady\uff0c\u6536\u5230\u4e24\u4e2a JSON \u5e8f\u5217\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TQJsonInputChannel \u662f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8],"tags":[],"class_list":["post-5394","post","type-post","status-publish","format-standard","hentry","category-delphi"],"views":1241,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5394"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5394\/revisions"}],"predecessor-version":[{"id":5395,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5394\/revisions\/5395"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}