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
- also `setx` for text-based value setting like `setx( '/a/b:123' )` (useful e.g. for constants in APIs or in unit-tests)
28
28
- seralization to string
29
29
- freezing (read only) instance content
30
-
- filtering. Create a json skipping empty values, predefined paths, or your custom filter.
30
+
- filtering. Create a JSON skipping empty values, predefined paths, or your custom filter.
31
31
- mapping - rule-based changing node names (e.g. snake case to camel case, upper/lower case)
32
32
- iterating through the array items or object members
33
-
- utility to calculate difference between 2 jsons
33
+
- utility to calculate difference between 2 JSONs
34
34
35
35
Installed using [abapGit](https://github.com/abapGit/abapGit), see also [Installation](https://sbcgua.github.io/ajson/docs/installation) section of the documentation.
Copy file name to clipboardExpand all lines: docsite/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ If you are using GitHub pages for hosting, this command is a convenient way to b
45
45
-`npm install --save @docusaurus/plugin-client-redirects` to support redirect from `/docs/` to `/docs/intro`
46
46
- redirect gh-actions to master
47
47
- logo works in wip
48
-
- prism `additionalLanguages: ['abap']`
48
+
- prism `additionalLanguages: ['ABAP']`
49
49
- add google analytics
50
50
- if blog link is above `truncate` is must be complete (start with `/`), otherwise will be broken on tags page
51
51
- change Repo/Settings/Pages/Source to Github actions (otherwise does not deploy from GA) - after that the pages are based on the GA artifact not the `gh-pages` branch! (TODO: maybe check how to deploy to a branch ... but maybe not)
Copy file name to clipboardExpand all lines: docsite/docs/10-intro.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,21 @@ sidebar_position: 10
4
4
5
5
# Introduction
6
6
7
-
AJson is a json parser/serializer for ABAP designed with the convenience for developer in mind. It works with abap release 7.02 or higher.
7
+
AJson is a JSON parser/serializer for ABAP designed with the convenience for developer in mind. It works with ABAP release 7.02 or higher.
8
8
9
9
## Features
10
10
11
-
- Parse json content into a flexible form, not fixed to any predefined data structure, allowing to modify the parsed data, selectively access its parts and slice subsections of it
11
+
- Parse JSON content into a flexible form, not fixed to any predefined data structure, allowing to modify the parsed data, selectively access its parts and slice subsections of it
12
12
- slicing can be particularly useful for REST header separation e.g. `{ "success": 1, "error": "", "payload": {...} }` where 1st level attrs are processed in one layer of your application and payload in another (and can differ from request to request)
13
-
- Allows conversion to fixed abap structures/tables (`to_abap`)
13
+
- Allows conversion to fixed ABAP structures/tables (`to_abap`)
14
14
- Convenient interface to manipulate the data - `set( value )`, `set( structure )`, `set( table )`, `set( another_instance_of_ajson )`, also typed e.g. `set_date`
15
15
- also `setx` for text-based value setting like `setx( '/a/b:123' )` (useful e.g. for constants in APIs or in unit-tests)
16
16
- Seralization to string
17
17
- Freezing (read only) instance content
18
-
- Filtering - create a json skipping empty values, predefined paths, or your custom filter.
18
+
- Filtering - create a JSON skipping empty values, predefined paths, or your custom filter.
19
19
- Mapping - rule-based changing node names (e.g. snake case to camel case, upper/lower case)
20
20
- Iterating (conveniently) through the array items or object members
Copy file name to clipboardExpand all lines: docsite/docs/50-writing.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,7 +267,7 @@ It is possible to set an instance of ajson immutable (read only). It is done on
267
267
268
268
## Keep item order
269
269
270
-
Sometimes you may want to keep order of json items in the same order as it was in abap structure (assuming you `set` structures or table of structures). To do this: set `iv_keep_item_order` flag when creating an instance or call `keep_item_order` after creation of instance, before any `set`.
270
+
Sometimes you may want to keep order of JSON items in the same order as it was in ABAP structure (assuming you `set` structures or table of structures). To do this: set `iv_keep_item_order` flag when creating an instance or call `keep_item_order` after creation of instance, before any `set`.
Copy file name to clipboardExpand all lines: docsite/docs/60-date-time.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ sidebar_position: 60
6
6
7
7
## Auto format date/time
8
8
9
-
By default date, time and timestamp dates are not formatted and are written in abap format as 'YYYYMMDD', 'HHMMSS'. This can be changed by calling `format_datetime` method after creation. After that the date/time will be auto-formatted as 'YYYY-MM-DD' and 'HH:MM:SS' respectively. **Important: this may become the default behavior in future version**
9
+
By default date, time and timestamp dates are not formatted and are written in ABAP format as 'YYYYMMDD', 'HHMMSS'. This can be changed by calling `format_datetime` method after creation. After that the date/time will be auto-formatted as 'YYYY-MM-DD' and 'HH:MM:SS' respectively. **Important: this may become the default behavior in future version**
10
10
11
11
```abap
12
12
data:
@@ -35,12 +35,12 @@ Conversion from JSON to ABAP can determine automatically if the value is a times
35
35
- mm = two digits of minute (00 through 59)
36
36
- ss = two digits of second (00 through 59)
37
37
- TZD = time zone designator (Z or +hh:mm or -hh:mm)
38
-
-abap base type of field is P (Packed)
39
-
- if the abap field has data element `timestampl`, then fractions of seconds are supported
38
+
-ABAP base type of field is P (Packed)
39
+
- if the ABAP field has data element `timestampl`, then fractions of seconds are supported
Copy file name to clipboardExpand all lines: docsite/docs/70-mapping.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ sidebar_position: 70
6
6
7
7
## How it works
8
8
9
-
You can rename json attribute (node) names with a mapper. Typical example for this is making all attribute names upper/lower case or converting camel-snake naming styles (e.g. `helloWorld -> hello_world`).
9
+
You can rename JSON attribute (node) names with a mapper. Typical example for this is making all attribute names upper/lower case or converting camel-snake naming styles (e.g. `helloWorld -> hello_world`).
@@ -26,7 +26,7 @@ Ajson implements a couple of frequent convertors in `zcl_ajson_mapping` class, i
26
26
- to camel case (`camelCase`)
27
27
- to snake case (`snake_case`)
28
28
29
-
You can also implement you custom mapper. To do this you have to implement `zif_ajson_mapping->rename_node()`. It accepts the json nodes item-by-item and may change name via `cv_name` parameter. E.g.
29
+
You can also implement you custom mapper. To do this you have to implement `zif_ajson_mapping->rename_node()`. It accepts the JSON nodes item-by-item and may change name via `cv_name` parameter. E.g.
30
30
31
31
```abap
32
32
method zif_ajson_mapping~rename_field.
@@ -36,7 +36,7 @@ You can also implement you custom mapper. To do this you have to implement `zif_
36
36
endmethod.
37
37
```
38
38
39
-
A realistic use case would be converting an external API result, which are often camel-cased (as this is very common in java-script world), and then converting it into abap structure:
39
+
A realistic use case would be converting an external API result, which are often camel-cased (as this is very common in java-script world), and then converting it into ABAP structure:
Copy file name to clipboardExpand all lines: docsite/docs/80-filtering.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ sidebar_position: 80
4
4
5
5
# Filtering
6
6
7
-
This feature allows creating a json from existing one skipping some nodes. E.g. empty values, predefined paths or using your custom filter.
7
+
This feature allows creating a JSON from existing one skipping some nodes. E.g. empty values, predefined paths or using your custom filter.
8
8
9
9
## Predefined filters
10
10
@@ -58,7 +58,7 @@ This feature allows creating a json from existing one skipping some nodes. E.g.
58
58
59
59
## Custom filters
60
60
61
-
In order to apply a custom filter you have to implement a class with `zif_ajson_filter` interface. The interface has one method `keep_node` which receives `is_node` - json tree node of `zif_ajson=>ty_node` type and also the `iv_visit` param. `iv_visit` will be `zif_ajson_filter=>visit_type-value` for all final leafs (str,num,bool,null) and will get `visit_type-open` or `visit_type-close` values for objects and arrays. So the objects and arrays will be called twice - before and after filtering - this allows examining their children number before and after the current filtering. For example of implementation see local implementations of `zcl_ajson_filter_lib` class.
61
+
In order to apply a custom filter you have to implement a class with `zif_ajson_filter` interface. The interface has one method `keep_node` which receives `is_node` - JSON tree node of `zif_ajson=>ty_node` type and also the `iv_visit` param. `iv_visit` will be `zif_ajson_filter=>visit_type-value` for all final leafs (str,num,bool,null) and will get `visit_type-open` or `visit_type-close` values for objects and arrays. So the objects and arrays will be called twice - before and after filtering - this allows examining their children number before and after the current filtering. For example of implementation see local implementations of `zcl_ajson_filter_lib` class.
0 commit comments