@abapify/asjson-parser 0.4.34 → 0.4.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +15 -87
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,105 +1,33 @@
1
1
  # @abapify/asjson-parser
2
2
 
3
- [![version](https://img.shields.io/github/package-json/v/abapify/adt-cli?filename=packages/asjson-parser/package.json)](https://github.com/abapify/adt-cli/pkgs/npm/%40abapify%2Fasjson-parser)
3
+ [![npm](https://img.shields.io/npm/v/%40abapify%2Fasjson-parser)](https://www.npmjs.com/package/@abapify/asjson-parser)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/abapify/adt-cli/blob/main/LICENSE)
4
5
 
5
- ABAP asJSON (canonical JSON representation) parser.
6
+ Parser for SAP ABAP asJSON canonical format — maps ABAP asJSON payloads to/from plain JavaScript objects.
6
7
 
7
- [asJSON](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_asjson.htm) - Canonical JSON Representation
8
+ ## Install
8
9
 
9
- General asJSON format is based on `%heap` object delivering values and type metadata
10
-
11
- So when we have a code like this:
12
-
13
- ```abap
14
- REPORT ZTEST_HEAP.
15
-
16
- start-of-selection.
17
-
18
- types:
19
- begin of payload_ts,
20
- i type i,
21
- i_ref type ref to i,
22
- end of payload_ts.
23
-
24
-
25
- data(payload) = value payload_ts(
26
- i = 123
27
- i_ref = new #( 123 )
28
- ).
29
-
30
- data(json) = cl_sxml_string_writer=>create( if_sxml=>co_xt_json ).
31
-
32
- call transformation id
33
- source data = payload
34
- result xml json.
35
-
36
- cl_demo_output=>display_json( json = json->get_output( ) ).
37
- ```
38
-
39
- the output it generates will be:
40
-
41
- ```json
42
- {
43
- "DATA":
44
- {
45
- "I":123,
46
- "I_REF":
47
- {
48
- "%ref":"#d1"
49
- }
50
- },
51
- "%heap":
52
- {
53
- "d1":
54
- {
55
- "%type":"xsd:int",
56
- "%val":123
57
- }
58
- }
10
+ ```bash
11
+ npm install @abapify/asjson-parser
59
12
  ```
60
13
 
61
- The following library allows us to parse this payload as if we would deal with a regular ABAP object without data references
62
-
63
- The code below
14
+ ## Usage
64
15
 
65
16
  ```ts
66
17
  import { parse } from '@abapify/asjson-parser';
67
- const parser;
68
- console.log(parse(json));
69
- ```
70
-
71
- would print the object like this:
72
18
 
73
- ```json
74
- {
75
- "DATA":
76
- {
77
- "I":123,
78
- "I_REF": 123
79
- }
19
+ const data = parse(asjsonPayload); // ABAP asJSON → plain JS object
80
20
  ```
81
21
 
82
- ## Usage
83
-
84
- - as a parser
22
+ ## Features
85
23
 
86
- ```ts
87
- import { parse } from '@abapify/asjson-parser';
88
- console.log(parse(json));
89
- ```
24
+ - Parses SAP asJSON canonical format (including references and heap)
25
+ - Maps ABAP payloads to plain JavaScript objects
90
26
 
91
- - as a transformer
27
+ ## Documentation
92
28
 
93
- ```ts
94
- import { transform } from '@abapify/asjson-parser';
95
- const object = JSON.parse(json);
96
- console.log(transform(object));
97
- ```
29
+ **[adt-cli.netlify.app/sdk/packages/asjson-parser](https://adt-cli.netlify.app/sdk/packages/asjson-parser)**
98
30
 
99
- - as a proxy (returns a proxied object)
31
+ ---
100
32
 
101
- ```ts
102
- import { proxy } from '@abapify/asjson-parser';
103
- const object = JSON.parse(json);
104
- console.log(proxy(object));
105
- ```
33
+ Part of [**abapify**](https://github.com/abapify/adt-cli) — open, typed tooling for SAP ABAP Development Tools (ADT): CLI, MCP server, and SDK.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abapify/asjson-parser",
3
- "version": "0.4.34",
3
+ "version": "0.4.38",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"