Solved

Convert PL/SQL record to JSON in Custom Projection

  • 14 February 2024
  • 3 replies
  • 113 views

Badge +7
  • Sidekick (Partner)
  • 17 replies

Hi,

We have implemented various custom projections and have a customer requirement to store the request and response payloads into a custom log table. Some payloads can be quite large so we have set these table fields to be of CLOB type.

Is there an easy way to convert the request and response payloads (which are of pl/sql record type) into a JSON CLOB format? Currently the only way we know of is to create the JSON from scratch using the values retrieved from the payloads. Is there some sort of utility, package or some other method that can be used to easily do the conversion?

Thanks!

icon

Best answer by dsj 15 February 2024, 00:33

View original

3 replies

Userlevel 7
Badge +20

Hi @mtoca 

When you are defining the structures in your projection, add ReadAndWrapWithJson property as mentioned here

Index - Technical Documentation For IFS Cloud

structure Expose using MyEntity {
nestedwithcrud = ReadAndWrapWithJson, ReadAndWrapWithXml, Create;
}

Then code generator will add the methods to convert to Json/XML

I have not used these myself for your kind of a requirement but I see the generated methods in my code ;)

 

 

It inputs the PLSQL array and outputs Json_Object_T

I’m entirely not sure how these methods are used by the framework  but I hope you can use them for your need.

 

Hope it helps!

Damith

Badge +7

@dsj You are a savior. This works! Thanks so much!

Userlevel 3
Badge +6

@dsj Thanks Damit… You are really a IFS super hero 😎

Reply