JSONGetElement must return numbers and booleans as numbers

Idea created by mrwatson-gbs on May 12, 2017
    Delivered
    Score33

    Issue

     

    JSONGetElement returns everything as text!

     

    Screen Shot 2017-05-12 at 23.22.24.png

    That is quatsch!

     

    NO other language does this to its JSON!

     

    Idea

     

    JSONGetElement should not only return the value of the element but also the data type, specifically:

     

    • If the queried JSON value is a number, the returned FileMaker value should be a number
    • If the queried JSON value is a boolean, the returned FileMaker value should be a number, i.e. the boolean number 0 or 1

     

    Benefits

     

    • JSON is JSON!
      • JSON works in FileMaker as it works in all other languages, i.e.:
      • JSONGet( JSONSet( x ) ) is the identity function and returns x
    • No 'Gotcha' moments ->
      • Less bugs
      • Greater productivity
    • No lengthy, elaborated, complicated, error prone workarounds
    • No Git hub repositories
    • No time-consuming explanations
    • Easier to use and learn
    • Just use it!
    • Make it FileMakery!
    • 1 or more happy developers
    • Greater acceptance of the FileMaker platform

     

    Use Cases

     

    • Working with numbers + counters: the following is a 'Gotcha' and would unexpectedly fail:
      • If[ JSONGetElement ( JSONSetElement ( "" ; "n" ; 45 ; JSONBoolean ) ; "n" ) > 9]
        • Show Custom Message[ "Error - only expecting one digit" ]
      • End If
    • Using JSON for what it was designed for: encoding and decoding data + data types
      • JSONGet( JSONSet ( x ) ) -> x // IDENTITY FUNCTION!

     

    --------

     

    @FMI -> Please consider this for fm16 rev 1!

     

    @developers -> Please let FMI know what we need -> Vote up, discuss, convince, animate, succeed.

     

    Make fm16 great again!

     

    MrWatson