Здесь я буду записывать предложения, которые возникают у меня при работе с классом cJSON.
Возможно у Вас когда-нибудь появится желание что-то из написанного переименовать и сделать ...

1. Полноценное управление выгрузкой тега в зависимости от его содержимого.
Можно считать это обобщением существующих опций: EmptyString / IgnoreFalse / IgnoreZero
Код: Выделить всё
{"Name":"Print","IsBool":true,"IgnoreValue":true}
{"Name":"Font", "IgnoreValue":11}
! "Name":"*" - здесь в принципе не нужен
Написание текстовых блоков OPTION в формате JSON - это красивая академическая идея для примеров.
Например, управление и поддержка вот таких настроек выгрузки одного из вариантов самого обычного кассового чека -
это попа полная (и там ещё 12 вложенных списков потом подключается со своими тегами):

Код: Выделить всё
Atol:J_Items Equate('{{"Name":"barcodeType","JsonName":"barcodeType"},' & |
'{{"Name":"pictureNumber","JsonName":"pictureNumber"},' & |
'{{"Name":"infoDiscountAmount","JsonName":"infoDiscountAmount"},' & |
'{{"Name":"measurementUnit","JsonName":"measurementUnit"},' & |
'{{"Name":"paymentMethod","JsonName":"paymentMethod"},' & |
'{{"Name":"paymentObject","JsonName":"paymentObject"},' & |
'{{"Name":"nomenclatureCode","JsonName":"nomenclatureCode"},' & |
'{{"Name":"additionalAttribute","JsonName":"additionalAttribute"},' & |
'{{"Name":"exciseSum","JsonName":"exciseSum"},' & |
'{{"Name":"countryCode","JsonName":"countryCode"},' & |
'{{"Name":"customsDeclaration","JsonName":"customsDeclaration"},' & |
'{{"Name":"userParam3","JsonName":"userParam3"},' & |
'{{"Name":"userParam4","JsonName":"userParam4"},' & |
'{{"Name":"userParam5","JsonName":"userParam5"},' & |
'{{"Name":"userParam6","JsonName":"userParam6"},' & |
'{{"Name":"markingCode","JsonName":"markingCode"},' & | ! GROUP / QUEUE
'{{"Name":"imcParams","JsonName":"imcParams"},' & |
'{{"Name":"agentInfo","JsonName":"agentInfo"},' & |
'{{"Name":"supplierInfo","JsonName":"supplierInfo"},' & |
'{{"Name":"productCodes","JsonName":"productCodes"},' & |
'{{"Name":"industryInfo","JsonName":"industryInfo"},' & |
'{{"Name":"customParameters","JsonName":"customParameters"},' & |
'{{"Name":"doubleWidth","JsonName":"doubleWidth","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"doubleHeight","JsonName":"doubleHeight","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"printText","JsonName":"printText","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"piece","JsonName":"piece","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"additionalAttributePrint","JsonName":"additionalAttributePrint","IsBool":true},' & |
'{{"Name":"print","JsonName":"print","IsBool":true},' & |
'{{"Name":"storeInJournal","JsonName":"storeInJournal","IsBool":true},' & | ! для Default: true
'{{"Name":"imcType","JsonName":"imcType"},' & |
'{{"Name":"itemEstimatedStatus","JsonName":"itemEstimatedStatus"},' & |
'{{"Name":"imcModeProcessing","JsonName":"imcModeProcessing","IgnoreZero":false},' & |
'{{"Name":"itemFractionalAmount","JsonName":"itemFractionalAmount"},' & |
'{{"Name":"imcBarcode","JsonName":"imcBarcode"},' & |
'{{"Name":"itemQuantity","JsonName":"itemQuantity"},' & |
'{{"Name":"itemUnits","JsonName":"itemUnits"},' & |
'{{"Name":"itemInfoCheckResult","JsonName":"itemInfoCheckResult"},' & |
'{{"Name":"imcCheckFlag","JsonName":"imcCheckFlag","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"imcCheckResult","JsonName":"imcCheckResult","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"imcStatusInfo","JsonName":"imcStatusInfo","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"imcEstimatedStatusCorrect","JsonName":"imcEstimatedStatusCorrect","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"ecrStandAloneFlag","JsonName":"ecrStandAloneFlag","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"payingAgent","JsonName":"payingAgent"},' & |
'{{"Name":"receivePaymentsOperator","JsonName":"receivePaymentsOperator"},' & |
'{{"Name":"moneyTransferOperator","JsonName":"moneyTransferOperator"},' & |
'{{"Name":"agentsPrint","JsonName":"agentsPrint","IsBool":true},' & | ! для Default: true
'{{"Name":"agentDataPrint","JsonName":"agentDataPrint","IsBool":true},' & |
'{{"Name":"supplierPrint","JsonName":"supplierPrint","IsBool":true},' & | ! для Default: true
'{{"Name":"supplierVatinPrint","JsonName":"supplierVatinPrint","IsBool":true},' & |
'{{"Name":"industryAttribute","JsonName":"industryAttribute"},' & |
| ! + добавляется на этапе выполнения
'{{"Name":"taxes","JsonName":"taxes"},' & |
'{{"Name":"industryInfo","JsonName":"industryInfo"},' & |
'{{"Name":"customParameters","JsonName":"customParameters"},' & |
'{{"Name":"salesNotice","JsonName":"salesNotice"},' & |
'{{"Name":"clientInfo","JsonName":"clientInfo"},' & |
'{{"Name":"companyInfo","JsonName":"companyInfo"},' & |
'{{"Name":"agentInfo","JsonName":"agentInfo"},' & |
'{{"Name":"supplierInfo","JsonName":"supplierInfo"},' & |
'{{"Name":"operationInfo","JsonName":"operationInfo"},' & |
'{{"Name":"taxationType","JsonName":"taxationType"},' & |
'{{"Name":"paymentsPlace","JsonName":"paymentsPlace"},' & |
'{{"Name":"paymentsAddress","JsonName":"paymentsAddress"},' & |
'{{"Name":"machineNumber","JsonName":"machineNumber"},' & |
'{{"Name":"electronically","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"ignoreNonFiscalPrintErrors","JsonName":"ignoreNonFiscalPrintErrors","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"validateMarkingCodes","JsonName":"validateMarkingCodes","IsBool":true,"IgnoreFalse":true},' & |
'{{"Name":"preItems","JsonName":"preItems","instance":' & Instance(Self.qPreItems, Thread()) & '},' & |
'{{"Name":"postItems","JsonName":"postItems","instance":' & Instance(Self.qPostItems,Thread()) & '},' & |
'{{"Name":"items","JsonName":"items","instance":' & Instance(qItems, Thread()) & '},' & |
'{{"Name":"payments","JsonName":"payments","instance":' & Instance(qPayments, Thread()) & '}')
(как идею для рассмотрения):
Код: Выделить всё
Self.OptClear('Набор1')
Self.OptSet('Набор1')
Self.OptAdd('"Name":"industryAttribute","JsonName":"industryAttribute"')
Self.OptAdd('"Name":"payingAgent","JsonName":"payingAgent"')
Self.OptClear('Набор2')
Self.OptSet('Набор2')
Self.OptAdd('"Name":"userParam3","JsonName":"userParam3,"IsBool":true"')
Object.ToGroup(gResponse,,'Набор1') ! Первые два символа не '[{{'
Json.ToGroup(JsonStr,NameObject,GroupResponse,'Набор2')
Self.OptFree()