JSON-

wts: https://otus.ru/journal/schema-json-i-comments-chto-nuzhno-znat/ ( "JSON Schema") : https://habr.com/ru/post/495766/.

: , , JSON , . , .

, https://json-schema.org/, benefits :
1.Describes your existing data format(s).
2. Provides clear human- and machine- readable documentation.
3. Validates data which is useful for:
    3.1 Automated testing.
    3.2 Ensuring quality of client submitted data.

.

&
 JVD_validate()
 
    (".C1ExternTools");
	 = (".C1ExternTools", "test", .Native);

	 =  ("AddIn.test.ExternToolsDRV");

  = "{
 |""$id"": ""tsdGoodsPosting"",
 |""description"": ""  ,       "",
 |""type"": ""object"",
 |""properties"": {
 | """": {
 |  ""type"": ""string"",
 |  ""pattern"": ""^20\\d{6}$""
 | },
 | """": {
 |  ""type"": ""string""
 | },
 | """": {
 |  ""type"": ""array"",
 |  ""items"": {
 |   ""$ref"": ""#/definitions/good""
 |  }
 | }
 |},
 |""definitions"": {
 | ""good"": {
 |  ""type"": ""object"",
 |  ""required"": [
 |   ""_"",
 |   """"
 |  ],
 |  ""properties"": {
 |   ""_"": {
 |    ""type"": ""string"",
 |    ""description"": """"
 |   },
 |   """": {
 |    ""type"": ""string"",
 |    ""description"": """"
 |   }
 |  }
 | }
 |}
 |}";
 
 
  = "
 |{
 |"""": ""20221125"",
 |"""": ""005-00001315"",
 |"""": [
 | {
 |  ""_"": ""90000013"",
 |  """": """"
 | },
 | {
 |  ""_"": ""90012291"",
 |  """": """"
 | }
 |]
 |}";
 
  = 	.JVD_(, );
 
  = JSON.JSON();
 
 (,);
 
  = "
 |{
 |"""": ""30221125"",
 |"""": ""005-00001315"",
 |"""": [
 | {
 |  ""_"": ""90000013"",
 |  """": """"
 | },
 | {
 |  ""_"": ""90012291""
 | }
 |]
 |}";
 
  = 	.JVD_(, );
 
  = JSON.JSON();
 
 (,);
  

:
1. {"Data":"","Description":["OK"],"Status":true}
2. {"Data":"","Description":[" ''. : <root> --> [] --> [1]"," RegEx. : <root> --> []"],"Status":false}

- . 1, . , json rest+json.

P.S.  jsoncpp valijson , - , - .

P.P.S.  Android : https://infostart.ru/public/1544296/

: 8.3.20.1674

https://github.com/KotVezdehod/ExternToolsDRV


1.PNG

. .
JSON-.:
.zip 279,28Kb
2
.zip 279,28Kb 2

© "", 2006-2023 www.infostart.ru