1
1
# Json Logic Scala
2
- Build complex rules, serialize them as JSON, and execute them in Scala
2
+ Build complex rules, serialize them as JSON, and execute them in Scala.
3
+
3
4
Json-logic-scala enables you to serialize in JSON format logical expressions.
4
5
It also enables you to load a scala object from a logical expression/JSON.
5
6
@@ -21,6 +22,27 @@ This project is compiled, tested, and published for the following Scala versions
21
22
* 2.12.6
22
23
* 2.13.1
23
24
25
+ # Table of Contents
26
+ 1 . [ Installation] ( )
27
+ 2 . [ Main concepts: Boolean-Algebra-Tree] ( )
28
+
29
+ 2.1 [ ` ComposeLogic ` : Internal Node] ( )
30
+
31
+ 2.2 [ ` ValueLogic ` : Leaf Node] ( )
32
+ 3 . [ Example] ( )
33
+ 4 . [ Read/Write json] ( )
34
+
35
+ 4.1 [ Read json: Define ` Decoder ` ] ( )
36
+
37
+ 4.2 [ Write json: Define ` Encoder ` ] ( )
38
+ 5 . [ Evaluating logical expression: ` reduce ` ] ( )
39
+
40
+ 5.1 [ ` reduceValueLogic ` method] ( )
41
+
42
+ 5.2 [ ` reduceComposeLogic ` method] ( )
43
+ 6 . [ More examples] ( )
44
+ 7 . [ Scaladoc API] ( )
45
+
24
46
## 1. Installation
25
47
26
48
To get started, add json-logic-scala as a dependency to your project:
@@ -94,7 +116,9 @@ filtering rules before loading it.
94
116
| ...........| ..........| ..........| ..........| ..........| .....................|
95
117
96
118
Let ' s suppose we are only interested in rows which satisfy logical expression :
97
- $price \ gte 20 \ and label \ neq label2$.
119
+ <p align =" center" >
120
+ <img src =" .img/logical_expression.png" alt =" drawing" width =" 200" />
121
+ </p >
98
122
If you want to store the logic (logical expression) in an universal format that can
99
123
be shared between scala, R , python code you can store in jsonLogic format.
100
124
@@ -365,7 +389,7 @@ implicit val reducer = new ReduceLogic() {
365
389
366
390
367
391
368
- ## Scaladoc API
392
+ ## 7 . Scaladoc API
369
393
370
394
The Scaladoc API for this project can be found [here](http:// celadari.github.io/ json- logic- scala/ latest/ api).
371
395
0 commit comments