PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WEBDEV 2024
→
[JSON] Dynamically get a specific key
[JSON] Dynamically get a specific key
Started by EKoster, Apr., 11 2021 8:58 AM - No answer
Connect yourself…
EKoster
#1
Registered member
16 messages
Posted on April, 11 2021 - 8:58 AM
I've a process to display messages, e.g. errors, a specific way. It uses a language based json file with groups of messages. In case of errors, the message can be technical or user friendly based on a parameter passed to a function. You don't want to give user a message with no meaning to them and when debugging you want the same situation to immediately help.
So I can read my JSON file into 'oMessages' which then includes:
{
"errors": {
"default": {
"SYS-001": "User friendly text"
},
"development": {
"SYS-001": "technical text"
}
}
I've a function to get a message. It gets a few parameters "strGroup", "strType", "strCode". What I can do in for example nodejs to get the message is "oMessages[strGroup][strType][strCode]". However in webdev I seem to do it in to steps. I can only get it working if I first put in a variable "oMessages[strGroup, strType]" and then from there do "variable[strCode]".
Is there a way to do it in one go?
Report
0
0
→ Go back to WEBDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text