GAP (json) - Chapter 1: GAP-JSON mapping

Goto Chapter: Top 1 Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax off]

1 GAP-JSON mapping
1.1 Methods
1.1-1 GapToJsonStream
1.1-2 GapToJsonString
1.1-3 JsonStringToGap
1.1-4 JsonStreamToGap

### 1 GAP-JSON mapping

This package defines a mapping between the JSON markup language and GAP. The built-in datatypes of GAP provide an easy mapping to and from JSON. This package uses the following mapping between GAP and JSON.

- JSON lists are mapped to GAP lists

- JSON dictionaries are mapped to GAP records

- JSON strings are mapped to GAP strings

- Integers are mapped to GAP integers, non-integer numbers are mapped to Floats

- true, false and null are mapped to true, false and fail respectively

Note that this library is *NOT* intended to provide a general purpose library for transmitting any GAP object. If you wish to do this, look at the openmath package, or IO_Pickle in the IO package.

#### 1.1 Methods

##### 1.1-1 GapToJsonStream

`‣ GapToJsonStream`( stream, value ) | ( function )

Converts the value to JSON, and outputs it to stream. This function disables GAP's usual line splitting while JSON is being outputted.

##### 1.1-2 GapToJsonString

`‣ GapToJsonString`( value ) | ( function )

Returns: string

Converts a GAP value to a JSON string.

##### 1.1-3 JsonStringToGap

`‣ JsonStringToGap`( string ) | ( function )

Returns: value

Converts a JSON string into a GAP value.

##### 1.1-4 JsonStreamToGap

`‣ JsonStreamToGap`( stream ) | ( function )

Returns: value

Reads a single JSON object from a stream and converts it to a GAP value.

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 Ind

generated by GAPDoc2HTML