adoptJSONObject in java step does not use pxExternalName qualifier set on properties

I need to be able to convert JSON to Page but its not comming from a web service so no Connect-REST or Service-REST is involved.

I'm using adoptJSONObject in a java step in an activity to parse the JSON as follows:

I have a property "oid" with pzExternalName qualifier set to "$oid".

I'm getting:

The reference $oid is not valid.  Reason: invalid property name: '$oid' 

How do Iget around this problem?

Java Step


ClipboardPage pgTemp = null;

String pageContent = "{\"id\":{\"$oid\":\"12345678\"}}";

pgTemp = ThreadContainer.get().getPublicAPI().createPage("<my class>","PageTemp");


} catch(InvalidStreamError e){

oLog.error("Test:Invalid JSON Stream for data page params : "+e.getMessage());

} catch(Exception e){

oLog.error("Test:Expection : "+e.getMessage());


***Edited by Moderator: Pallavi to update platform capability tags***


Keep up to date on this post and subscribe to comments

January 8, 2019 - 8:31am


January 25, 2019 - 1:26pm



June 14, 2019 - 8:14am

Hi Daniel,

Can we not strip JSON of special character and get this thing working. 
Internal Implementation of adoptJSONObject just takes property name from key and tries to map with name of the property. pxExternalName is not used.

This is something you were asking about it seems.


June 15, 2019 - 9:14am

Yes, I can strip out the special characters and make it work. Thats what I'm doing now. That will work as long as the same property does not exist.  For example if I had "$code" and "code" in the same json then stripping the characters wouldn't work. Yes, I could rig it up to work somehow with a bunch of find replacing. Buts thats sloppy.

But my point is, Pega has the capability to handle special characters in the JSON somehow OOTB for when it receives JSON with a REST rule. PEga is using the pzExternalName qualifier on properties to map properties with special characters.  So, I'm just wondering, what exactly is Pega doing OOTB to accomplish this.