Skip to main content
Solved

Convert PL/SQL record to JSON in Custom Projection

  • Feb 14, 2024 4:19 PM UTC
  • 3 replies
  • 570 views

Forum|alt.badge.img+7

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!

Best answer by dsj

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

View original

3 replies

dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • Answer
  • Feb 14, 2024 11:33 PM UTC

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


Forum|alt.badge.img+7
  • Author
  • Sidekick (Partner)
  • Feb 15, 2024 2:27 PM UTC

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


MizanulIslam
Hero (Partner)
Forum|alt.badge.img+8
  • Hero (Partner)
  • Feb 15, 2024 2:31 PM UTC

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