Title: JSON &#8211; variable is null or not
Last modified: March 10, 2020

---

# JSON – variable is null or not

 *  Resolved [celin007](https://wordpress.org/support/users/celin007/)
 * (@celin007)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/json-variable-is-null-or-not/)
 * Hi,
 * I want to check if a variable is null or not. Eg: if variable {date} is not null,
   I want to display date. Both ifNotEmptyAddLeft and ifNotEmptyAddRight doesnt 
   work as there should be a text next to the variable.
 * I want to show just the variable{date}, no text should be before or after it.
 * Can you please help?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/json-variable-is-null-or-not/#post-12528388)
 * Hi,
 * I’m not sure what is your challenge.
    If {..} is empty, nothing is displayed.
 * Try this:
    [jsoncontentimporter url=http://wptest.kux.de/extra/celin007.php] 
   date1: {date1} – {date1:ifNotEmptyAddRight:extratext1}<br> date2: {date2} – {
   date2:ifNotEmptyAddRight:extratext2}<br> date3: {date3} – {date3:ifNotEmptyAddRight:
   extratext3}<br> date4: {date4} – {date4:ifNotEmptyAddRight:extratext4}<br> [/
   jsoncontentimporter]
 * Bernhard
 *  Thread Starter [celin007](https://wordpress.org/support/users/celin007/)
 * (@celin007)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/json-variable-is-null-or-not/#post-12529891)
 * Hi Bernhard,
 * Thanks for the quick response.
 * Imagine the variable date has value 2/3/2020
    The variable {date} will have value
   for a time period (for example from 1/3/2020 to 20/3/2020). All other times the
   value will be null.
 * Input – {date:ifNotEmptyAddRight} **output **is empty
    Input – {date:ifNotEmptyAddRight:{
   date}} **output **shows 2/3/2020 2/3/2020 (displays twice)
 * I want to display just the date not any text in front or after it.
 * Is it possible to display just the date if not null?
 * Thanks for all your help.
 * Kind Regards
    Celin
    -  This reply was modified 6 years, 3 months ago by [celin007](https://wordpress.org/support/users/celin007/).
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/json-variable-is-null-or-not/#post-12534180)
 * Hi Celin,
 * why is just using {date} not enough?
 * Bernhard
 *  Thread Starter [celin007](https://wordpress.org/support/users/celin007/)
 * (@celin007)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/json-variable-is-null-or-not/#post-12534298)
 * Thanks Bernhard. You are a genius, I didn’t think that way.
 * Regards
    Celin

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘JSON – variable is null or not’ is closed to new replies.

 * ![](https://ps.w.org/json-content-importer/assets/icon-256x256.png?rev=3464653)
 * [Get Use APIs - JSON Content Importer](https://wordpress.org/plugins/json-content-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-content-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-content-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/json-content-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-content-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-content-importer/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [celin007](https://wordpress.org/support/users/celin007/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/json-variable-is-null-or-not/#post-12534298)
 * Status: resolved