Skip to main content
August 7, 2023
Question

a!fromJson()

  • August 7, 2023
  • 3 replies
  • 0 views

when I run the functon a!fromJson(). It gives the error

Error:==

The JsonText parameter does must not be null or empty

what should i do

    3 replies

    stefanhelzle0001
    Brainy
    August 7, 2023

    You cannot pass a NULL value to that function. Where is this coming from? If it is OK that there is a NULL value, then wrap the call into an if() and check for NULL using a!isNullOrEmpty(). If it is NOT OK, I suggest to use the error() function to make others aware of that situation.

    August 7, 2023

    local!search:if(a!isNullOrEmpty(ri!input),

    {},

    a!fromJson(ri!input)

    ),

    local!pagingInfo:a!pagingInfo(

    startIndex:local!search.startIndex,

    batchSize:local!search.batchSize

    )

    when i apply a!nullorEmpty(ri!nput).in a!fromJson(ri!input)..It gives error at startIndex

    error:-

    invalid index:cannot index property startIndex of type String into type List of Variant

    stefanhelzle0001
    Brainy
    August 7, 2023

    What are you trying to do here? What is this JSON data you are dealing with?

    So, the dot-notation will fail in case that field does not exists. This is what the error message means.

    You can use the index() or property() function to fetch values from fields. It allows you to provide a default value in case the field does not exist.