I have created a table name 'drugs' in chicagoboss. Mnesia has been used. Schema of the table is:
id, generic_name, brand_name, description
One record of the table is:
{
drugs,
"drugs-3",
"Generic name",
["Trade Name","AnotherTradeName"],
"This is the description of the drug"
}
To print the data in json format the code I have used:
-module(appname_drug_controller, [Req]).
-compile(export_all).
get('GET',[])->
ADrugs=boss_db:find("drugs-3"),
{json, [{resposne,ADrugs}]}.
I supposed to get:
{
"resposne": {
"id": "drugs-3",
"generic_name": "Generic name",
"brand_name": [
"Trade Name",
"AnotherTradeName"
],
"description": "This is the description of the drug"
}
}
But I am getting:
{
"resposne": {
"id": "drugs-3",
"generic_name": "Generic name",
"brand_name": "Trade NameAnotherTradeName",
"description": "This is the description of the drug"
}
}
So instead of array brand_name is returned as a single line of string. How can I get the correct structure?