Documentation

Code examples

What follows are some basic examples in PHP and JavaScript of how to work with the data that the Justfields JSON endpoint serves. JSON is a very common format that is supported by all modern programming languages, so chances are your favorite programming language also can work with it.


How to load Justfields JSON data using PHP

    $fields = json_decode(file_get_contents('https://justfields.com/project/1bvE8yWw/json'), TRUE);

echo '<h1>' . $fields['example_group']['page_title'] . '</h1>';

foreach( $fields['example_group']['teammembers'] as $teammember):
  echo $teammember['name'] . ' (' . $teammember['position'] .')<br>';
endforeach;


How to load Justfields JSON data using JavaScript

Live Codepen example can be found here: https://codepen.io/bramchi/pen/bGpKKYX

fetch('https://justfields.com/project/1bvE8yWw/json')
  .then( response => response.json() )
  .then( function ( data ) {
    data.example_group.teammembers.forEach( function( teammember ){
      console.log(teammember.name, teammember.position)
    })
  })
    
      

Continue to read about Password protection.