s dyn={}
d dyn.%Set("asNumber",123)
d dyn.%Set("asString",123,"string")


w dyn.%ToJSON()

{"asNumber":123,"asString":"123"}

Is it possible that you added index definitions after you filled the table with data?

If that is the case, then those indices are not built ("empty"), and so if the query uses them, then it returns no data. In such case you have to build your indices manually via ##class(MML.Cities).%BuildIndices().

I've contacted WRC about this, and their answer is that there is no built-in way.

They offered a workaround of enabling unauthenticated access and checking AUTHORIZATION header manually.