Today I'm officially augmenting my JSON2.ASP class with a toXML method which takes a Javascript object with JSON notation and returns it's XML version. My algorithm is a very fast implementation of the prof. Stefan Gössner bijective transformation between JSON and XML exposed in this article.


This javascript:

var nagaozen = {
    full_name:"Fabio Zendhi Nagao",
    nickname: "nagaozen",
    gender: "male",
    age: 27,
    title: "Founder & CTO - Evolved",
    education: {
        "@active": true,
        technical: {
            location: "Federal Technique School of Sao Paulo",
            degree: "Technical data processing",
            final_work: "E-commerce framework"
        undergraduate: {
            location: "University of Sao Paulo",
            degree: "BSc. Applied and Computational Mathematician",
            thesis: "Mathematical Modeling of Collective Intelligence"
        graduate: {
            location: "University of Sao Paulo",
            degree: "MSc. Computing Science",
            thesis: "unknown"
    likes: ["Manoela", "Family (dogs included)", "Internet", "Programming", "Design", "Philosophy"],
    dislikes: [],
    a_few_aliens_i_know: {},
    contact: "nagaozen[at]"

is converted into this XML:

<?xml version="1.0"?>
    <full_name>Fabio Zendhi Nagao</full_name>
    <title>Founder &amp; CTO - Evolved</title>
    <education active="true">
            <location>Federal Technique School of Sao Paulo</location>
            <degree>Technical data processing</degree>
            <final_work>E-commerce framework</final_work>
            <location>University of Sao Paulo</location>
            <degree>BSc. Applied and Computational Mathematician</degree>
            <thesis>Mathematical Modeling of Collective Intelligence</thesis>
            <location>University of Sao Paulo</location>
            <degree>MSc. Computing Science</degree>
    <likes>Family (dogs included)</likes>


  • Get JSON2.ASP from inside the ASP Xtreme Evolution repository.