Sie sind auf Seite 1von 2

What is a JSON Parser for ABAP.

JSON or JavaScript Object Notation, is a lightweight text-based open standard de


signed for
human-readable data interchange. It is derived from the JavaScript scripting lan
guage for
representing simple data structures and associative arrays, called objects. Desp
ite its
relationship to JavaScript, it is language-independent, with parsers available f
or many
languages. The JSON parser for ABAP is a class in ABAP that is able to interpret
JSON and
return ABAP Data and vice versa. With JSON parser for ABAP you then can support
RESTful web services as integration with SAP.
Why is JSON interesting for ABAP developers.
JSON is interesting for ABAP developers, because JSON with BSP (Business Server
Pages)
allow simple exposure of data from SAP to the Internet, without the use of SOA a
nd the
administration that follows. From ABAP you could also call web services on the i
nternet, that
return JSON as result. Nearly every web developer knows the JSON format, web too
ls and
programming languages support JSON directly in the runtime environment.
By using BSP and ICF services, we are able to provide URI/URL for the web develo
per, that
can be assigned to classes or functions within SAP. Hereby we are able to delive
r any data
from SAP or receive any data to SAP, that any ABAP developer can work with, usin
g well
known tools like RFC function modules or ABAP classes.
If we build a REST service, within ABAP that hide special HTTP issues from the A
BAP
developer, and hide special SAP knowledge from the Web developer, we will be abl
e to
expose any SAP data on the internet or on any mobile devices, that can be used b
y any kind
of web solution, whether nor using SAP web tools like Web Dynpro, Portal, ITS an
d similar.
The only piece missing, is some kind of utility that can serialize ABAP data to
JSON
or deserialize JSON data to ABAP data. This missing link, is what this article i
s
about. The REST service will be explained and described in a later article.
On SDN http://www.sdn.sap.com/ you can read other articles and source code, that
address the same issue. I have been using several of these solutions, but found
they
were too performance demanding, or was missing the deserialize function. Therefo
re
I spend some time to figure out another way of serializing and deserializing.
What is the benefit for you...
1. The article explain some of the choises in the solution,
2. The article show you the code behind the JSON parser within ABAP,
3. You can use this solution as inspiration for other types of issues, where you
need
to work with dynamic structured complex data,
4. The class support the JSON format entirely, as describe at http://www.JSON.or
g
with very few exceptions.
What you should know...
1. You need to be an experienced ABAP developer,
2. You need some skils and knowledge about ABAP objects,
3. You should have an idea of what object design pattern is,
4. You should be familar with recursive calls,
5. You should have some understanding for web developments,
6. You must read about JSON at http:///www.json.org.
Introduction to JSON
JSON or JavaScript Object Notation, is a lightweight text-based open standard de
signed for
human-readable data interchange. It is derived from the JavaScript scripting lan
guage for
representing simple data structures and associative arrays, called objects. Desp
ite its
relationship to JavaScript, it is language-independent, with parsers available f
or many
languages.
The official internet media type for JSON is application/JSON. The JSON filename
extension
is .JSON.
The JSON format is often used for serializing and transmitting structured data o
ver a network
connection. It is used primarily to transmit data between a server and web appli
cation,
serving as an alternative to XML.

Das könnte Ihnen auch gefallen