Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I'm wondering if I'm just expecting too much from sp_parse_json and would welcome others feedback based on the json file available here

One task for example is to collate a list of all import_measures and then identify which Countries apply to each.

Is this feasible as a task in SQL Anywhere or should I be looking to use another language outside of SQL Anywhere?

asked 27 Oct '23, 12:24

pcollins's gravatar image

pcollins
1915612
accept rate: 0%


IMHO The sp_parse_json function is great to use for simple scenarios and consistent and relatively simple structures. SQL puts strict constraints on data types and structures so it isn't suited for data that varies. For any complex JSON or complex processing I would recommend using a different language, something that handles variable-typed data structures. My personal favorite is Perl (I've been writing perl since ~1990) but I suspect most people these days would recommend Python, or in the case of JSON Javascript would be a good language to use.

Check out external procedures in the SQLA reference. You could write your complex parsing and processing of the json data in an external procedure and then pass it back to SQLA for storage or further processing.

HTH

permanent link

answered 27 Oct '23, 14:24

Mark%20Culp's gravatar image

Mark Culp
25.0k10142298
accept rate: 41%

1

Thanks Mark, I actually went to Perl for my workaround, although I'm simply using Perl to convert the JSON to XML and reading in what data I need from that.

I'm happy that I'm not overlooking something.

(27 Oct '23, 19:59) pcollins
Replies hidden
Comment Text Removed

Do you use any particular library for the JSON to XML conversion? (Not that I'm proficient at all with Perl...)

(30 Oct '23, 12:30) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×30

question asked: 27 Oct '23, 12:24

question was seen: 316 times

last updated: 30 Oct '23, 12:30