diff --git a/jolt-demo/cardinality/input.json b/jolt-demo/cardinality/input.json new file mode 100644 index 00000000..b4e78ff8 --- /dev/null +++ b/jolt-demo/cardinality/input.json @@ -0,0 +1,5 @@ +{ + "review" : { + "rating" : [ 5, 4 ] + } +} \ No newline at end of file diff --git a/jolt-demo/cardinality/input2.json b/jolt-demo/cardinality/input2.json new file mode 100644 index 00000000..021c5cbe --- /dev/null +++ b/jolt-demo/cardinality/input2.json @@ -0,0 +1,10 @@ +{ + "views": [ + { + "count": 1024 + }, + { + "count": 2048 + } + ] +} \ No newline at end of file diff --git a/jolt-demo/cardinality/spec.json b/jolt-demo/cardinality/spec.json new file mode 100644 index 00000000..ec686747 --- /dev/null +++ b/jolt-demo/cardinality/spec.json @@ -0,0 +1,10 @@ +[ + { + "operation": "cardinality", + "spec": { + "review": { + "rating": "ONE"//取rating数组第一个元素,输出:{"review":{"rating":5}} + } + } + } +] \ No newline at end of file diff --git a/jolt-demo/cardinality/spec2.json b/jolt-demo/cardinality/spec2.json new file mode 100644 index 00000000..16e34ed7 --- /dev/null +++ b/jolt-demo/cardinality/spec2.json @@ -0,0 +1,13 @@ +[ + { + "operation": "cardinality", + "spec": { + "views": { + "@": "ONE", + "count": "MANY" + } + } + } +] +//在cardinality场景,@用于声明当前层级的基数规则 +//作为特殊键名"@"出现,值为基数规则("ONE"或"MANY"),通常位于嵌套对象内部 \ No newline at end of file diff --git a/jolt-demo/default/input.json b/jolt-demo/default/input.json new file mode 100644 index 00000000..9705f1dd --- /dev/null +++ b/jolt-demo/default/input.json @@ -0,0 +1,14 @@ +{ + "Rating": 3, + "SecondaryRatings": { + "quality": { + "Range": 7, + "Value": 3, + "Id": "quality" + }, + "sharpness": { + "Value": 4, + "Id": "sharpness" + } + } +} \ No newline at end of file diff --git a/jolt-demo/default/input2.json b/jolt-demo/default/input2.json new file mode 100644 index 00000000..bd5ec5fa --- /dev/null +++ b/jolt-demo/default/input2.json @@ -0,0 +1,7 @@ +{ + "name": "Alice", + "age": null, + "contact": { + "phone": "12345" + } +} \ No newline at end of file diff --git a/jolt-demo/default/input3.json b/jolt-demo/default/input3.json new file mode 100644 index 00000000..d7f93ab0 --- /dev/null +++ b/jolt-demo/default/input3.json @@ -0,0 +1,15 @@ +{ + "photos": [ + { + "id": "327704", + "url": "http://bob.com/0001/327704/photo.jpg" + }, + { + "id": "327705", + "url": "http://bob.com/0002/327704/photo.jpg" + }, + { + "id": "327706" + } + ] +} \ No newline at end of file diff --git a/jolt-demo/default/spec.json b/jolt-demo/default/spec.json new file mode 100644 index 00000000..27db35a9 --- /dev/null +++ b/jolt-demo/default/spec.json @@ -0,0 +1,11 @@ +[ + { + "operation": "default", + "spec": { + "Range": 5, + "data": { + "default": 12345 + } + } + } +] diff --git a/jolt-demo/default/spec2.json b/jolt-demo/default/spec2.json new file mode 100644 index 00000000..9b00e021 --- /dev/null +++ b/jolt-demo/default/spec2.json @@ -0,0 +1,10 @@ +[ + { + "operation": "default", + "spec": { + "age": 18, // 原始 age 是 null,会被填充为 18 + "gender": "female", // 原始无 gender 字段,会被添加 + "active": true // 原始无 active 字段,会被添加 + } + } +] \ No newline at end of file diff --git a/jolt-demo/default/spec3.json b/jolt-demo/default/spec3.json new file mode 100644 index 00000000..1a0e6f9b --- /dev/null +++ b/jolt-demo/default/spec3.json @@ -0,0 +1,13 @@ +[ + { + "operation": "default", + "spec": { + "photos[]": { + "2": { + "url": "http://www.bazaarvoice.com", + "caption": "" + } + } + } + } +] \ No newline at end of file diff --git a/jolt-demo/modify/input.json b/jolt-demo/modify/input.json new file mode 100644 index 00000000..b7608ac4 --- /dev/null +++ b/jolt-demo/modify/input.json @@ -0,0 +1,23 @@ +{ + "x": [ + 3, + 2, + 1, + "go" + ], + "small": "small", + "BIG": "BIG", + "people": [ + { + "firstName": "Bob", + "lastName": "Smith", + "address": { + "state": null + } + }, + { + "firstName": "Sterling", + "lastName": "Archer" + } + ] +} \ No newline at end of file diff --git a/jolt-demo/modify/spec.json b/jolt-demo/modify/spec.json new file mode 100644 index 00000000..ac1c25cc --- /dev/null +++ b/jolt-demo/modify/spec.json @@ -0,0 +1,19 @@ +[ + { + "operation": "modify-default-beta", + "spec": { + "y": "=join(',',@(1,x))", + "z": "=join(' ',@(1,x))", + "small_toUpper": "=toUpper(@(1,small))", + "BIG_toLower": "=toLower(@(1,BIG))", + "people": { + "*": { + "fullName": "=concat(@(1,firstName),' ',@(1,lastName))", + "address?": { + "state": "Texas" + } + } + } + } + } +] \ No newline at end of file diff --git a/jolt-demo/remove/input.json b/jolt-demo/remove/input.json new file mode 100644 index 00000000..c20deacb --- /dev/null +++ b/jolt-demo/remove/input.json @@ -0,0 +1,11 @@ +{ + "~emVersion": "2", + "id": "123124", + "productId": "31231231", + "submissionId": "34343", + "this": "stays", + "configured": { + "a": "b", + "c": "d" + } +} \ No newline at end of file diff --git a/jolt-demo/remove/input2.json b/jolt-demo/remove/input2.json new file mode 100644 index 00000000..e1df2a52 --- /dev/null +++ b/jolt-demo/remove/input2.json @@ -0,0 +1,12 @@ +{ + "ratings": { + "Set1": { + "a": "a", + "b": "b" + }, + "Set2": { + "c": "c", + "b": "b" + } + } +} \ No newline at end of file diff --git a/jolt-demo/remove/input3.json b/jolt-demo/remove/input3.json new file mode 100644 index 00000000..162f4a79 --- /dev/null +++ b/jolt-demo/remove/input3.json @@ -0,0 +1,22 @@ +{ + "ratings_legacy": { + "Set1": { + "a": "a", + "b": "b" + }, + "Set2": { + "a": "a", + "b": "b" + } + }, + "ratings_new": { + "Set1": { + "a": "a", + "b": "b" + }, + "Set2": { + "a": "a", + "b": "b" + } + } +} \ No newline at end of file diff --git a/jolt-demo/remove/spec.json b/jolt-demo/remove/spec.json new file mode 100644 index 00000000..cc4eea5c --- /dev/null +++ b/jolt-demo/remove/spec.json @@ -0,0 +1,13 @@ +[ + { + "operation": "remove", + "spec": { + "~emVersion": "", + "productId": "", + "submissionId": "", + "configured": { + "c": "" + } + } + } +] \ No newline at end of file diff --git a/jolt-demo/remove/spec2.json b/jolt-demo/remove/spec2.json new file mode 100644 index 00000000..5cd68678 --- /dev/null +++ b/jolt-demo/remove/spec2.json @@ -0,0 +1,12 @@ +[ + { + "operation": "remove", + "spec": { + "ratings": { + "*": { + "b": "" + } + } + } + } +] \ No newline at end of file diff --git a/jolt-demo/remove/spec3.json b/jolt-demo/remove/spec3.json new file mode 100644 index 00000000..f323d5a5 --- /dev/null +++ b/jolt-demo/remove/spec3.json @@ -0,0 +1,10 @@ +[ + { + "operation": "remove", + "spec": { + "ratings_*": { + "Set1": "" + } + } + } +] \ No newline at end of file diff --git a/jolt-demo/shift/input.json b/jolt-demo/shift/input.json new file mode 100644 index 00000000..3194b3ca --- /dev/null +++ b/jolt-demo/shift/input.json @@ -0,0 +1,14 @@ +{ + "orderId": 1212, + "orderNo": "202223434343", + "goods": { + "goodsId": 123, + "goodsName": "test_goods" + }, + "orderItem": [ + { + "orderItemId": 1324, + "orderItemNo": "34535345" + } + ] +} diff --git a/jolt-demo/shift/input10.json b/jolt-demo/shift/input10.json new file mode 100644 index 00000000..c2e45ff0 --- /dev/null +++ b/jolt-demo/shift/input10.json @@ -0,0 +1,3 @@ +{ + "foo": "1" +} \ No newline at end of file diff --git a/jolt-demo/shift/input11.json b/jolt-demo/shift/input11.json new file mode 100644 index 00000000..863ba1ff --- /dev/null +++ b/jolt-demo/shift/input11.json @@ -0,0 +1,4 @@ +{ + "author": "Stephen Hawking", + "book": "A Brief History of Time" +} \ No newline at end of file diff --git a/jolt-demo/shift/input12.json b/jolt-demo/shift/input12.json new file mode 100644 index 00000000..6eab8b12 --- /dev/null +++ b/jolt-demo/shift/input12.json @@ -0,0 +1,6 @@ +{ + "Photos": [ + "AAA.jpg", + "BBB.jpg" + ] +} \ No newline at end of file diff --git a/jolt-demo/shift/input13.json b/jolt-demo/shift/input13.json new file mode 100644 index 00000000..9934b710 --- /dev/null +++ b/jolt-demo/shift/input13.json @@ -0,0 +1,4 @@ +{ + "photo-1-id": "327704", + "photo-1-url": "http://bob.com/0001/327704/photo.jpg" +} \ No newline at end of file diff --git a/jolt-demo/shift/input14.json b/jolt-demo/shift/input14.json new file mode 100644 index 00000000..0d5c8a68 --- /dev/null +++ b/jolt-demo/shift/input14.json @@ -0,0 +1,3 @@ +{ + "foo": 3 +} \ No newline at end of file diff --git a/jolt-demo/shift/input15.json b/jolt-demo/shift/input15.json new file mode 100644 index 00000000..8e7a41e5 --- /dev/null +++ b/jolt-demo/shift/input15.json @@ -0,0 +1,4 @@ +{ + "foo" : "bar", + "tuna" : "marlin" +} \ No newline at end of file diff --git a/jolt-demo/shift/input2.json b/jolt-demo/shift/input2.json new file mode 100644 index 00000000..9951501b --- /dev/null +++ b/jolt-demo/shift/input2.json @@ -0,0 +1,8 @@ +{ + "rating": { + "quality": { + "value": 3, + "max": 5 + } + } +} \ No newline at end of file diff --git a/jolt-demo/shift/input3.json b/jolt-demo/shift/input3.json new file mode 100644 index 00000000..d56bece9 --- /dev/null +++ b/jolt-demo/shift/input3.json @@ -0,0 +1,16 @@ +{ + "rating": { + "primary": { + "value": 3, // 希望此值转到输出路径 "Rating" + "max": 5 // 希望此值转到输出路径 "RatingRange" + }, + "quality": { // 想要输出路径 "SecondaryRatings.quality.Id" = "quality",我们想要使用key的值 + "value": 3, // 希望此值转到输出路径“SecondaryRatings.quality.value” + "max": 5 // 希望此值转到输出路径“SecondaryRatings.quality.Range” + }, + "sharpness": { // 想要输出路径“SecondaryRatings.sharpty.Id”=“sharpture” + "value": 7, // 希望此值转到输出路径“SecondaryRatings.sharps.value” + "max": 10 // 希望此值转到输出路径“SecondaryRatings.sharps.Range” + } + } +} diff --git a/jolt-demo/shift/input4.json b/jolt-demo/shift/input4.json new file mode 100644 index 00000000..c50aad66 --- /dev/null +++ b/jolt-demo/shift/input4.json @@ -0,0 +1,12 @@ +{ + "rating" : { + "quality": { + "value": 3, + "max": 5 + }, + "sharpness" : { + "value" : 7, + "max" : 10 + } + } +} \ No newline at end of file diff --git a/jolt-demo/shift/input5.json b/jolt-demo/shift/input5.json new file mode 100644 index 00000000..47e57ea1 --- /dev/null +++ b/jolt-demo/shift/input5.json @@ -0,0 +1,4 @@ +{ + "tag-Pro-a": "Awesome", + "tag-Con-b": "Bogus" +} \ No newline at end of file diff --git a/jolt-demo/shift/input6.json b/jolt-demo/shift/input6.json new file mode 100644 index 00000000..db39049a --- /dev/null +++ b/jolt-demo/shift/input6.json @@ -0,0 +1,12 @@ +{ + "rating": { + "primary": { + "value": 3, + "max": 5 + }, + "quality": { + "value": 3, + "max": 7 + } + } +} \ No newline at end of file diff --git a/jolt-demo/shift/input7.json b/jolt-demo/shift/input7.json new file mode 100644 index 00000000..7bc87520 --- /dev/null +++ b/jolt-demo/shift/input7.json @@ -0,0 +1,7 @@ +{ + "ratings": { + "primary": 5, + "quality": 4, + "design": 5 + } +} \ No newline at end of file diff --git a/jolt-demo/shift/input8.json b/jolt-demo/shift/input8.json new file mode 100644 index 00000000..40e77b87 --- /dev/null +++ b/jolt-demo/shift/input8.json @@ -0,0 +1,3 @@ +{ + "hidden": true +} \ No newline at end of file diff --git a/jolt-demo/shift/input9.json b/jolt-demo/shift/input9.json new file mode 100644 index 00000000..77bba560 --- /dev/null +++ b/jolt-demo/shift/input9.json @@ -0,0 +1,3 @@ +{ + "rating": "1" +} \ No newline at end of file diff --git a/jolt-demo/shift/spec.json b/jolt-demo/shift/spec.json new file mode 100644 index 00000000..19fbfb65 --- /dev/null +++ b/jolt-demo/shift/spec.json @@ -0,0 +1,24 @@ +[ + { + "operation": "shift", + "spec": { + "orderId": "data.order_id", + "orderNo": "data.order_no", + "orderItem": { + "*": { + "orderItemId": "data.order_item.[#2].order_item_id", + "orderItemNo": "data.order_item.[#2].order_item_no" + } + } + } + }, + { + "operation": "default", + "spec": { + "Range": 5, + "data": { + "default": 12345 + } + } + } +] diff --git a/jolt-demo/shift/spec10.json b/jolt-demo/shift/spec10.json new file mode 100644 index 00000000..2028f033 --- /dev/null +++ b/jolt-demo/shift/spec10.json @@ -0,0 +1,28 @@ +[ + { + "operation": "shift", + "spec": { + "foo": { + "$": "place.to.put.key",//$获取到key本身,输出到place.to.put.key、place.to.put.key=foo + "@": "place.to.put.value"//@获取到key对应的value,输出到place.to.put.value、place.to.put.value=1 + } + } + } +] +//在LHS,@是根节点,不允许有子节点??? +//在LHS中,@代表当前处理层级的根位置(不是整个输入json的root!) +//@对应的value只能为简单只,比如1、"2"、"xxxx"、不能是"foo":{"xx":"1"} +//@的设计是直接提取当前层级的完整值,而非遍历子树 +//若值本身是对象(如 { "address": { ... } }),则@无法处理其内部字段,需改用其他通配符(如&或*) + +//{ +// "place": { +// "to": { +// "put": { +// "key": "foo", +// "value": "1" +// } +// } +// } +//} + diff --git a/jolt-demo/shift/spec11.json b/jolt-demo/shift/spec11.json new file mode 100644 index 00000000..0ff7685e --- /dev/null +++ b/jolt-demo/shift/spec11.json @@ -0,0 +1,11 @@ +[ + { + "operation": "shift", + "spec": { + "@author": "@book" + } + } +] + +//@author取author对应的value(Stephen Hawking)作为@book=Stephen Hawking +//@book取book对应的value作为「输出的」key,A Brief History of Time=Stephen Hawking \ No newline at end of file diff --git a/jolt-demo/shift/spec12.json b/jolt-demo/shift/spec12.json new file mode 100644 index 00000000..1b5409c2 --- /dev/null +++ b/jolt-demo/shift/spec12.json @@ -0,0 +1,12 @@ +[ + { + "operation": "shift", + "spec": { + "Photos": { + "1": "photo-&-url" + // 指定只匹配数组下标为1的数据 + } + } + } +] +// & 取key值 \ No newline at end of file diff --git a/jolt-demo/shift/spec13.json b/jolt-demo/shift/spec13.json new file mode 100644 index 00000000..64d84e3e --- /dev/null +++ b/jolt-demo/shift/spec13.json @@ -0,0 +1,9 @@ +[ + { + "operation": "shift", + "spec": { + "photo-1-id": "Photos[1].Id",//输出到Photos[1].Id、1是索引 + "photo-1-url": "Photos[1].Url"//输出到Photos[1].Url + } + } +] \ No newline at end of file diff --git a/jolt-demo/shift/spec14.json b/jolt-demo/shift/spec14.json new file mode 100644 index 00000000..5e215944 --- /dev/null +++ b/jolt-demo/shift/spec14.json @@ -0,0 +1,11 @@ +[ + { + "operation": "shift", + "spec": { + "foo": [ + "bar", + "baz" + ] + } + } +] \ No newline at end of file diff --git a/jolt-demo/shift/spec15.json b/jolt-demo/shift/spec15.json new file mode 100644 index 00000000..0f881f9d --- /dev/null +++ b/jolt-demo/shift/spec15.json @@ -0,0 +1,9 @@ +[ + { + "operation": "shift", + "spec": { + "foo": "baz", + "tuna": "baz" + } + } +] \ No newline at end of file diff --git a/jolt-demo/shift/spec2.json b/jolt-demo/shift/spec2.json new file mode 100644 index 00000000..4f813d70 --- /dev/null +++ b/jolt-demo/shift/spec2.json @@ -0,0 +1,14 @@ +[ + { + "operation": "shift", + "spec": { + "rating": { + "quality": { + "value": "SecondaryRatings.quality.Value", // 输出 SecondaryRatings.quality.Value:3 + "max": "SecondaryRatings.quality.RatingRange" // 输出 SecondaryRatings.quality.RatingRange:5 + } + } + } + } +] +//"SecondaryRatings.quality.RatingRange" 代表输出路径 \ No newline at end of file diff --git a/jolt-demo/shift/spec3.json b/jolt-demo/shift/spec3.json new file mode 100644 index 00000000..0d1056c1 --- /dev/null +++ b/jolt-demo/shift/spec3.json @@ -0,0 +1,20 @@ +[ + { + "operation": "shift", + "spec": { + "rating": { + "primary": { + "value": "Rating",//输出Rating:3 + "max": "RatingRange"//输出RatingRange:5 + }, + "*": {//匹配rating层级的quality、sharpness,除了primary + "value": "SecondaryRatings.&1.Value",//左边:rating.*.value :右边: SecondaryRatings.*.Value + "max": "SecondaryRatings.&1.Range",//左边:rating.*.max :右边: SecondaryRatings.*.Range + "$": "SecondaryRatings.&1.Id" //表示使用输入键本身的值作为数据、左边 rating.*.quality or sharpness :右边: SecondaryRatings.*.Id + } + } + } + } +] +// * 通配符只能在LHS使用、* 代表匹配整个key字符串,user-* 代表匹配以user开头的key字符串 +// &1 是回溯引用,指向上一层通配符 * 匹配到的键(如 "quality") \ No newline at end of file diff --git a/jolt-demo/shift/spec4.json b/jolt-demo/shift/spec4.json new file mode 100644 index 00000000..23a40358 --- /dev/null +++ b/jolt-demo/shift/spec4.json @@ -0,0 +1,15 @@ +[ + { + "operation": "shift", + "spec": { + "rating": { + "*": { + "max": "Rating.[#2].amx",//左边rating.*.max : 右边:Rating[{max:5}] + "value": "Rating.[#2].value"//左边rating.*.value:右边:Rating[{value:3}] + } + } + } + } +] + +//[#2]代表生成数组 \ No newline at end of file diff --git a/jolt-demo/shift/spec5.json b/jolt-demo/shift/spec5.json new file mode 100644 index 00000000..730d3812 --- /dev/null +++ b/jolt-demo/shift/spec5.json @@ -0,0 +1,35 @@ +[ + { + "operation": "shift", + "spec": { + "tag-*-*": "&(0,0)"//左边:* 是通配符,匹配所有以 tag- 开头的键、右边:& 是 Jolt 的引用操作符,用于提取匹配结果。 + } + } +] +//&在LHS和RHS都能使用,&是引用操作符 +//(0,1) 指定引用方式:0:表示整个匹配的键,如 tag-Pro、1:表示通配符 * 捕获的部分 +//&(0,1) 的含义:取匹配键中第一个通配符捕获的部分(即删除 tag- 前缀) + +//在 Jolt 的 shift 操作中,& 是引用操作符,用于提取匹配模式中的特定部分。括号内的两个参数 (a,b) 分别表示: +//a(层级回溯数):指定从当前匹配位置向上回溯的层级数**(0 表示当前层级,1 表示父级,以此类推) +//b(通配符序号):指定使用第几个通配符捕获组**(从 1 开始计数) +//简记:0 是“起点定位”,1 是“目标提取” + +//Jolt 通过路径层级管理数据匹配。a 参数控制回溯深度,解决嵌套结构问题: +//**&(0,1)**:当前层级 → 直接取 * 内容(如 Pro) +//**&(1,1)**:回溯一级父层级 → 若父级是数组/对象,可能取父级键名 +//**&(2,1)**:回溯两级 → 更上层的键名 + +//&在输入路径寻找值: +//{ +// "foo" : { +// "bar": { +// "baz": // &0 = baz, &1 = bar, &2 = foo +// } +// } +//} + +//需要指明使用第几个匹配值,比如说"tag-*-*"匹配到"tag-Foo-Bar",那么: +// &(0,0) = "tag-Foo-Bar" +// &(0,1) = "Foo" +// &(0,2) = "Bar" \ No newline at end of file diff --git a/jolt-demo/shift/spec6.json b/jolt-demo/shift/spec6.json new file mode 100644 index 00000000..dbe28e10 --- /dev/null +++ b/jolt-demo/shift/spec6.json @@ -0,0 +1,15 @@ +[ + { + "operation": "shift", + "spec": { + "rating": { + "*": { // 匹配“rating”以下的所有key + "$": "ratings" // 将每个“key”输出到输出中的“rating” + } + } + } + } +] +//即输出JSON的value既可以是输入JSON的value,也可以是输入JSON的key +//在匹配到每个子键时,$捕获该键的名称本身 +//$本质是键名提取器 diff --git a/jolt-demo/shift/spec7.json b/jolt-demo/shift/spec7.json new file mode 100644 index 00000000..5c9f0afd --- /dev/null +++ b/jolt-demo/shift/spec7.json @@ -0,0 +1,28 @@ +[ + { + "operation": "shift", + "spec": { + "ratings": { + "*": { + "$": "Ratings[#2].Name",//"Ratings[#2].Name": 将当前键(例如 "primary") 作为值输出到 Ratings[#2].Name。其中 $ 表示键的名称 + "@": "Ratings[#2].Value"//"Ratings[#2].Value": 将当前值(例如 5) 作为值输出到 Ratings[#2].Value。其中 @ 表示值。 + } + } + } + } +] + +//#2实际表示向上回溯两级,索引从 0 开始 +//#number 用于引用树中的层级索引 + +//#2的核心作用:回溯路径层级,完成动态索引填充 +//当前路径:root(0) → ratings(1) → *(2) → 当前操作(3) +//#2表示从第3级向上回溯2级,即回到第1级(ratings层级) +//回溯后,Jolt会获取该层级(如ratings)下匹配项的运行时索引值(从0开始自动生成) +//例如:输入JSON的ratings有3个子键:primary(索引0)、quality(索引1)、design(索引2) +//处理primary时,#2回溯到ratings并获取索引0;处理design时获取索引2 + +//在LHS RHS都可以使用,但是意义不同 +//在RHS, #号只在数组中有效 比如[#2] +//在LSH中,#允许您指定硬编码字符串作为输出中的值 +//在LSH中,#是根节点,不允许有子节点 \ No newline at end of file diff --git a/jolt-demo/shift/spec8.json b/jolt-demo/shift/spec8.json new file mode 100644 index 00000000..fe7134bb --- /dev/null +++ b/jolt-demo/shift/spec8.json @@ -0,0 +1,12 @@ +[ + { + "operation": "shift", + "spec": { + "hidden" : { + "true" : { // 如果"hidden" 值是true + "#disabled" : "clients.clientId" //将 "disabled" 值写到 "clients.clientId",标准格式是 #(disabled) #disabled会自动转成#(disabled) + } + } + } + } +] \ No newline at end of file diff --git a/jolt-demo/shift/spec9.json b/jolt-demo/shift/spec9.json new file mode 100644 index 00000000..c8f42e04 --- /dev/null +++ b/jolt-demo/shift/spec9.json @@ -0,0 +1,9 @@ +[ + { + "operation": "shift", + "spec": { + "rating|Rating" : "rating-primary" // 匹配 "rating" or "Rating" 输出到rating-primary + } + } +] +//|代表或的意思 \ No newline at end of file diff --git a/jolt-demo/sort/input.json b/jolt-demo/sort/input.json new file mode 100644 index 00000000..02ce8fc5 --- /dev/null +++ b/jolt-demo/sort/input.json @@ -0,0 +1,6 @@ +{ + "a": "0", + "b": "-1", + "r": "9", + "d": "2" +} \ No newline at end of file diff --git a/jolt-demo/sort/spec.json b/jolt-demo/sort/spec.json new file mode 100644 index 00000000..2aed259f --- /dev/null +++ b/jolt-demo/sort/spec.json @@ -0,0 +1,5 @@ +[ + { + "operation": "sort" + } +] \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9bad684a..427b4f78 100644 --- a/pom.xml +++ b/pom.xml @@ -78,6 +78,8 @@ 1.3.7 2.1.46 + 2.1.46 + 0.1.8 org.springframework.boot @@ -422,6 +424,33 @@ jsch 0.1.53 + + + + + + + + + + + + + + + + + + + com.bazaarvoice.jolt + jolt-core + ${latest.jolt.version} + + + com.bazaarvoice.jolt + json-utils + ${latest.jolt.version} + @@ -572,7 +601,6 @@ false -