GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aidan-harding/apex-json-reader: A simple way to read data from JSON by specifying path expressions. Written in Salesforce Apex

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
force-app/main/default/classes
force-app/main/default/classes
 
 
.forceignore
.forceignore
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
sfdx-project.json
sfdx-project.json
 
 

Repository files navigation

JSON Reader

Read values from JSON by specifying simple paths like 'a.b' or 'a.b[2].c'.

Examples

Basic usage:

String jsonString = '{"a": { "a2": "expected"} }';

Object result = new JsonReader(jsonString).read('a.a2');

System.assertEquals('expected', result);

With lists:

String jsonString = '{"a": { "a2": ["x", ["expected"]] } }';

Object result = new JsonReader(jsonString).read('a.a2[1][0]');

System.assertEquals('expected', result);

Specifying behaviour for missing keys:

String jsonString = '{"a": { "a2": "expected"} }';
final String NO_RESULT = 'no result';

Object result = new JsonReader(jsonString)
        .setMissingKeyResult(NO_RESULT)
        .read('a.nope');

System.assertEquals(NO_RESULT, result);

License

MIT, see LICENSE

About

A simple way to read data from JSON by specifying path expressions. Written in Salesforce Apex

Resources

Readme
MIT license
Activity

Stars

17 stars

Watchers

2 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.