Has anyone already written a JSON parser/encoder for Harbour?
( if you don't know what JSON is look at json.org )

Is there any C developer interested to add C code for dbf <-> xml
and/or dbf <-> json?

The idea is to have C code that reads one or more records with usual
fields,rest,next,for,while clauses and that returns an XML string that
can be node or attributes based or a JSON structure. Also it should
get an XML or a JSON structure and update a record.

C would be great since this kind of conversions are the base of an
AJAX app and a lot of time if spent in loops like:

cXml += "<table>"
for allrecs selected
cXml += "<row><recno>" + XTOC( recno() ) + "</recno>
for allfields selected
   cXml += "<" +fieldname(nField) + ">" + XTOC( fieldget( nfield ) ) +
"</" + fieldname(nField) + ">"
next
cXml += "</row>"
next
cXml += "</table>"

and then

oXml := TXMLDoc( cXml )

for every node/attrib
fieldput(fieldpos(<node/attrib name>),CTOX(node/attrib value))
next

note that XTOC and CTOX requires many calls to things like:

switch valtype(field)
    case "D"
      cString := DTOS( field )
...
endswitch

it would be great to have sth like:

COPY XML|JSON to VAR|FILE cString [FIELDS <field1, field2>] [FOR/WHILE <cond>]
and
REPLACE|UPDATE FIELDS <nfield1, nfield2> WITH XML|JSON cString

that manages the conversions for numbers, dates and logicals at C level.

Any comment?

best regards,
Lorenzo
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to