ethar turky
asked on
modification in js code
Dear all,
The code in http://jsfiddle.net/VM3jc/5/
assume following json string
I need to modify the code to accept same json string but without "TableName" element
and add default on "TableName": "TablNameDefault"
Thanks.
The code in http://jsfiddle.net/VM3jc/5/
assume following json string
[
{
"TableName": "TableName1",
"languages": [
{
"name": "ID",
"column_type": type2
},
{
"name": "NameAR",
"column_type": "type1"
}
]
},
{
"TableName": "Tabs",
"languages": [
{
"name": "FieldNameID",
"column_type": type2
},
{
"name": "FieldName02",
"column_type": "type1"
},
{
"name": "FieldName03",
"column_type": "type1"
}
]
},
{
"TableName": "TablName2",
"languages": [
{
"name": "CustomerID",
"column_type": type2
},
{
"name": "FullName",
"column_type": "type1"
},
{
"name": "Address",
"column_type": "type1"
}
]
}
]
I need to modify the code to accept same json string but without "TableName" element
and add default on "TableName": "TablNameDefault"
Thanks.
ASKER
still, json parser assume the string have TableName:
I need to deal with a string contains no "TableName:"
and add it ( programmatically ) to the json
I need to deal with a string contains no "TableName:"
and add it ( programmatically ) to the json
ASKER
can jsonfied add "TableName": "TablNameDefault" if its not shown in the string?
How do you know when a new table begins?
Now your input string is something like:
Now your input string is something like:
Tablename1:
FieldNameID,typ1
FieldName02,typ2
FieldName03,typ3
Tablename:
FieldNameID,typ4
FieldName02,typ1
FieldName03,typ2
Like this I know that each time I find something that ends with : it's a table name. If I don't have this line how do I know which fields belong to what?
ASKER
if no Tablename1:
consider all as one table
if
consider all as one table
if
FieldNameID,typ1
FieldName02,typ2
FieldName03,typ3
FieldNameID,typ4
FieldName02,typ1
FieldName03,typ2
just treated it as :TablNameDefault:
FieldNameID,typ1
FieldName02,typ2
FieldName03,typ3
FieldNameID,typ4
FieldName02,typ1
FieldName03,typ2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I didn't understand what you need here and how this relates to the sample.
Before you had a string and wanted to convert it to json.
Now you have json and want to do what?
Please give me an exact sample of the input and the expected output.