Skip to contents

This function returns a list that jsonlite::toJSON() will always encode as {}.

Usage

js_obj(x = list())

Arguments

x

A list, or list-like object.

Value

A list with the names attribute set.

Examples


    library(webqueue)
    
    updates <- list()
    
    response(list(updates = updates))
#> HTTP/1.1 200 OK
#> Content-Type: application/json; charset=utf-8
#> 
#> {"updates":[]}
    
    response(list(updates = js_obj(updates)))
#> HTTP/1.1 200 OK
#> Content-Type: application/json; charset=utf-8
#> 
#> {"updates":{}}