Delphi RESTClient解析JSON

时间:2017-09-25 13:45:23

标签: json rest delphi delphi-10.2-tokyo

我在RESTDebugger(Delphi东京)中使用TRESTClient,TRESTRequest,FRESTResponse和RESTResponseDataSetAdapter,它运行正常但是对于一个JSONValue,webservice发送了一些HTML混合,它在我的TFDMemTable中没有显示正确的东西。

我使用JSONViewer进行相同的测试,它会做同样的事情

有没有办法在开始解析我的RestReponse之前修改我的JSONStream?

为什么它不显示dev_msg_attention_to_garage的所有JSONString?

{"id_commande":"15672","id_devis":"16347","status":"CONFIRM","res_codres":"IDG","nom_client":"TESTRDV","prenom_client":"toto","mail":"test@test.fr","tel_port":"0606060606","date_prise_rdv":"2017-09-25 09:25:43.281269","date_rdv":"2017-09-27","heure_rdv":"17:30-18:00","immatriculation":"EC620XP        ","type_prestation":"FREINAGE","famille":"Disques et plaquettes avant","type_mine":"","codmar":"PEUG","numord":"9938","marque":"PEUGEOT","marque_modele":"PEUGEOT 206 1.1 60CV","cnit":"MPE1002K6315","aaa_caliloca":null,"aaa_cape":null,"aaa_ccreditbail":null,"aaa_canton":null,"aaa_carrosserie":"BERLINE","aaa_carrosseriecg":"CI","aaa_catclient":null,"aaa_catclientvo":null,"aaa_catvendeur":null,"aaa_co2":"154","aaa_codifvin":"VF32AHFZE40061368","aaa_consexurb":"5.1","aaa_consmixte":"6.2","aaa_consurb":"8.2","aaa_couleurvehic":"MARRON","aaa_cstrvincg":null,"aaa_cylindree":"1124","aaa_date1ercir":"1998-10-15","aaa_datedcg":"2016-06-09","aaa_datedcgachat":null,"aaa_datedcgpr":null,"aaa_datedcgprachat":null,"aaa_depart":null,"aaa_departement":null,"aaa_depollution":"NON","aaa_empat":"245.0","aaa_empreintesol":null,"aaa_energie":"ESSENCE","aaa_gammemarche":null,"aaa_genrev":"VP","aaa_genrevcg":"VP","aaa_hauteur":"144","aaa_immatsiv":"EC620XP","aaa_largeur":"165","aaa_longueur":"384","aaa_marque":"PEUGEOT","aaa_marquecarros":"PEUGEOT","aaa_modeinject":"AUTR. CARBURATIONS","aaa_moderefroid":null,"aaa_modele":"206","aaa_modeleetude":"206","aaa_modeleprf":"206","aaa_mouvmt":null,"aaa_nserie":"40061368","aaa_nsiren":"000000000","aaa_nbcylind":"4","aaa_nbdecibels":null,"aaa_nbmain":null,"aaa_nbplass":"5","aaa_nbportes":"5","aaa_nbpropriet":null,"aaa_nbsoupape":"2","aaa_nbvitesse":"5","aaa_nbvolume":"2","aaa_nuancecouleur":null,"aaa_poidsvide":"910","aaa_prixvehic":"0","aaa_propulsion":"AVANT","aaa_ptr":"1405","aaa_ptrprf":"0192","aaa_puisch":"60","aaa_puisfisc":"5","aaa_rappuispoids":null,"aaa_regionadmin":null,"aaa_regmdecibels":null,"aaa_statutimmat":null,"aaa_temoincession":null,"aaa_tpboitevit":"MECANIQUE","aaa_transmiss":null,"aaa_turbocompr":"NON TURBO","aaa_type":"MPE1002K6315","aaa_typevincg":"2AHFZE","aaa_version":"XR\/PRESE","aaa_voiear":null,"aaa_voieav":null,"aaa_datews":"2017-06-16","aaa_3lnom":"fff","veh_codmar":null,"veh_numord":null,"veh_ktypenr":null,"aaa_pneus":"175\/65 R14 82 T, 165\/70 R13 79 T","aaa_typevarversprf":"2AHFZE","aaa_codemoteur":"HFZ","aaa_puiskw":"44","total_ht":"141.58","total_tva":"28.32","total_ttc":"169.90","total_ttc_max":"169.90","total_ttc_min":"169.90","dev_msg_attention_to_garage":"                                    \r\n                        \r\n                            \r\n                            attention\r\n                            \r\n                                ATTENTION Pour ce rendez-vous web nous avons identifi&eacute;\r\n                                plusieurs r&eacute;f&eacute;rences constructeur possible :<\/br\/>\r\n                                                                                                                                                                                         4249A5, <b>424995<\/b><br\/>     \r\n                                <br \/>Vous devez vous assurer que la\r\n                                r&eacute;f&eacute;rence indiqu&eacute;e correspond bien &agrave;\r\n                                celle mont&eacute;e sur le v&eacute;hicule du client <br \/>Le\r\n                                prix final &agrave; payer par le client doit &ecirc;tre de 169,90 \u20AC TTC                            \r\n                        \r\n                    \r\n\t\r\n \/ Le devis est en pi\u00E8ce budget","dev_msg_from_customer":"test message;\r\n","id":"15672","created_at":"2017-09-25 09:25:43.460187","updated_at":"2017-09-25 09:26:10.621387","coupon":[],"promotion_globale":[],"lignes_pieces":[{"codfam":"FDI","ssfam":"AV","designation_piece":"DISQUE DE FREIN AV PLEIN. DIAMETRE= 247X10MM","ref_constructeur":"424995","quantity":"2.00","remise":"0.00","pu":"0.00","taux_tva":null},{"codfam":"FPL","ssfam":"AV","designation_piece":"PLAQUETTES DE FREIN AV. MONTAGE BOSCH","ref_constructeur":"425320","quantity":"1.00","remise":"0.00","pu":"0.00","taux_tva":null}],"lignes_mo":[{"type_ligne":"FOI","designation_mo":"Forfait Isotech ","ref_operation_adauto":"FISOAD16990","quantity":"1.00","taux_horaire":"141.58","remise":null,"code_taux_horaire":null,"taux_tva":1.2,"montant_ht_ligne_apres_remise":141.58}],"deduction_rdv_en_ligne_ttc":"16.99","montant_a_regler_par_client":152.91,"pourcentage_remise_calculee_pieces":0,"total_remises":0,"total_ht_avant_remises":141.58,"pourcentage_remises":0,"pourcentage_remise_calculee_mo":0}

enter image description here

1 个答案:

答案 0 :(得分:1)

您被视为Windows' Tree View的限制。来自文档:

  

请注意,虽然树视图控件允许将任何长度的字符串存储为项目文本,但仅显示前260个字符

(强调我的)

快速的答案是,由于这个控件包含了Delphi的TTreeView实现,它也继承了这个限制,因此除了实现之外,你不能做太多的事情来克服它。自定义绘图或找到另一个没有此限制的控件。