Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6650525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:54:10+00:00 2026-05-26T00:54:10+00:00

We have a large code base that makes copious use of the JSON v1

  • 0

We have a large code base that makes copious use of the JSON v1 API:

use JSON;
my $json = objToJson($data);
my $data = jsonToObj($json);

We would like to upgrade to JSON v2, so we can start using it in new code, and because we’ve been encountering other modules that depend on the v2 API.

However, if I have stored a utf8-string created by objToJson(), it will no longer be decoded in the same way by JSON::XS (which is what JSON v2 uses behind the scenes).

use JSON;
use JSON::XS;
use warnings;
use strict;

my $data    = ["\x{263a}b"];
my $encoded = JSON::objToJson($data);
print "different!\n"
  unless JSON::jsonToObj($encoded)->[0] eq JSON::XS::decode_json($encoded)->[0];
print "different!\n"
  unless JSON::jsonToObj($encoded)->[0] eq JSON::XS->new->decode($encoded)->[0];

Is there any way for us to upgrade to JSON v2, but still leave around the v1 API for backward compatibility with existing code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:54:11+00:00Added an answer on May 26, 2026 at 12:54 am

    Modules should use a new name when they do drastic changes like that. In this case, the fact that JSON 2.x is mostly a wrapper for JSON::XS conveniently means that’s kind what they did.

    I recommend:

    1. Leave JSON 1.x installed.
    2. Install JSON::XS.
    3. At your leisure, convert from JSON 1.x to JSON::XS.
    4. It’s now safe to upgrade to JSON 2.x if you want.
      1. Install JSON 2.x
      2. s/JSON::XS/JSON/g
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have taken over a large code base and would like to get an
I inherited a moderately large sized code base that makes extensive use of mysql_fetch_assoc
I have a very large code base that contains extensive unit tests (using CppUnit).
I have the source for a large (>250 files) library that makes heavy use
I have a large C++ code base that I'm doing some refactoring on where
I have a large code base that resides on a unix server, and for
At work we have a very large code-base that we commonly export for a
I have a very large codebase (read: thousands of modules) that has code shared
We have a large code base in MFC and VB. A few applications are
We have a large ASP classic code base but I'm looking to do future

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.