GithubHelp home page GithubHelp logo

coltonfischer / ps-jsonify Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 0.0 246 KB

Convert PeopleCode Objects to JSON

Home Page: http://www.coltonfischer.com/ps-jsonify/

peopletools peoplecode peoplesoft json

ps-jsonify's Introduction

PS-Jsonify

View the Documentation Site for complete API details.

Dependencies

You must be on PeopleTools 8.55 or later.

Installing

Download and import the PeopleSoft project into App Designer

How to Use

The PS-Jsonify library offers three consumer App Classes: PSM_JSON:Object, PSM_JSON:Array, and PSM_JSON:Node. These three classes can be used to build and parse JSON Objects, Arrays, and Nodes respectively.

Building JSON Objects

Use the PSM_JSON:Object Class to build JSON Objects.

Local PSM_JSON:Object &oJson = create PSM_JSON:Object();

The various AddXxx methods allow you to add PeopleCode object types to the JSON Object.

Local Rowset &rsOperDefn = CreateRowset(Record.PSOPRDEFN);
&rsOperDefn.Fill("WHERE OPRID = 'PS'");
   
&oJson.AddRowset("MyRowset", &rsOperDefn);

Use the AddProperty method if you are unsure of the data or object type.

Local any &aValue = CreateArrayAny("test", True, 6, Null);
   
If Int(Rand() * 10) > 5 Then
   &aValue = Null;
End-If;
   
&oJson.AddProperty("MyProperty", &aValue);

Invoke the ToJsonString method to get the JSON String output.

Local String &sOutput = &oJson.ToJsonString();

See the JSON Object section to view all of the available methods and properties.

Building JSON Arrays

Use the PSM_JSON:Array Class to build JSON Arrays.

Local PSM_JSON:Array &oJson = create PSM_JSON:Array();

The various AddXxx methods allow you to add PeopleCode object types to the JSON Array.

Local Record &rPsOptions = CreateRecord(Record.PSOPTIONS);
&rPsOptions.SelectByKey();
   
&oJson.AddRecord(&rPsOptions);

Use the AddElement method if you are unsure of the data or object type.

Local any &aValue = %Request;
   
If Int(Rand() * 10) > 5 Then
   &aValue = %Response;
End-If;
   
&oJson.AddElement(&aValue);

Invoke the ToJsonString method to get the JSON String output.

Local String &sOutput = &oJson.ToJsonString();

See the JSON Array section to view all of the available methods and properties.

Building JSON Nodes

Use the PSM_JSON:Node Class to build JSON Nodes.

Local PSM_JSON:Node &oJson = create PSM_JSON:Node();

The various SetXxx methods allow you convert PeopleCode object types to a JSON Node.

Local PTPP_COLLECTIONS:Shortcut &oCref;
&oCref = create PTPP_COLLECTIONS:Shortcut(%Portal, "PT_CHANGE_PASSWORD_GBL");
   
&oJson.SetClass(&oCref);

Invoke the ToJsonString method to get the JSON String output.

Local String &sOutput = &oJson.ToJsonString();

See the JSON Node section to view all of the available methods and properties.

Note: Not all PeopleCode object types are supported. ToJsonString will return the object type name as a String if you use an unsupported type.

ps-jsonify's People

Contributors

coltonfischer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.