Gulp XML to Json

To converting xml to json format we have a gulp-xml2json available. follow these step to convert xml to json.

    var gulp = require('gulp'),
        xml2json = require('gulp-xml2json'),
        rename = require('gulp-rename');

    gulp.task('sitemapjson', function () {
        gulp.src('sitemap.xml')
            .pipe(xml2json())
            .pipe(rename({extname: '.json'}))
            .pipe(gulp.dest('./'));
    });

A good scenario is to download the sitemap.xml file from online sitemap generator then convert the xml file to json with gulp-xml2json then integrate it with gulp-psi to get a page speed of all available pages of your website.

Leave a Reply

Your email address will not be published. Required fields are marked *