You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, a JSON obfuscator will obfuscate all properties; for object and array properties, their contents in the document including opening and closing characters will be obfuscated. This can be turned on or off for all properties, or per property. For example:
.forArrays(ObfuscationMode.INHERIT_OVERRIDABLE) // override the default setting
33
+
.build();
34
+
```
31
35
32
36
The four possible modes for both objects and arrays are:
33
37
*`EXCLUDE`: don't obfuscate nested objects or arrays, but instead traverse into them.
@@ -39,77 +43,93 @@ The four possible modes for both objects and arrays are:
39
43
40
44
JSON obfuscators perform obfuscating by generating new, obfuscated JSON documents. By default this will use pretty-printing. This can be turned off when creating JSON obfuscators:
If the structure of the original JSON document needs to be kept intact, you should use [obfuscation-jackson](https://robtimus.github.io/obfuscation-jackson/) instead.
48
54
49
55
## Producing valid JSON
50
56
51
57
If string values are obfuscated, the obfuscated value remains quoted. For other values, the obfuscated values are not quoted. This could lead to invalid JSON. For instance:
52
58
53
-
{
54
-
"boolean": ***
55
-
}
59
+
```json
60
+
{
61
+
"boolean": ***
62
+
}
63
+
```
56
64
57
65
For most use cases this is not an issue. If the obfuscated JSON needs to be valid, this can be achieved by converting obfuscated values to strings:
An exception is made for [Obfuscator.none()](https://robtimus.github.io/obfuscation-core/apidocs/com/github/robtimus/obfuscation/Obfuscator.html#none--). Since this obfuscator does not actually obfuscate anything, any property that is configured to use it will be added as-is. This still allows skipping obfuscating values inside certain properties:
If malformed JSON is encountered, obfuscation aborts. It will add a message to the result indicating that obfuscation was aborted. This message can be changed or turned off when creating JSON obfuscators:
This library uses the Java API for Processing JSON ([JSR 374](https://www.jcp.org/en/jsr/detail?id=374)) for parsing and generating JSON. By default it uses the Glassfish reference implementation. If you want to use a different implementation instead, you should exclude the Glassfish dependency, and add a dependency for that different implementation. In your POM:
0 commit comments