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 8144267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:19:52+00:00 2026-06-06T13:19:52+00:00

I have the following almost JSON string: <?php $string = ‘{0:{id:1,name:Antiek en Kunst,subs:[{id:2,name:Antiek |

  • 0

I have the following almost JSON string:

<?php
$string = '{0:{"id":1,"name":"Antiek en Kunst","subs":[{"id":2,"name":"Antiek | Bestek"},{"id":3,"name":"Antiek | Boeken en Bijbels"},{"id":1100,"name":"Antiek | Emaille"},{"id":1501,"name":"Antiek | Gereedschap en Instrumenten"},{"id":1648,"name":"Antiek | Glas en Kristal"},{"id":2614,"name":"Antiek | Goud en Zilver"},{"id":2661,"name":"Antiek | Kandelaars"},{"id":1841,"name":"Antiek | Kantoor en Zakelijk"},{"id":1502,"name":"Antiek | Keramiek en Aardewerk"},{"id":1842,"name":"Antiek | Keukenbenodigdheden"},{"id":2118,"name":"Antiek | Kleden en Textiel"},{"id":1503,"name":"Antiek | Kleding en Accessoires"},{"id":6,"name":"Antiek | Klokken"},{"id":1647,"name":"Antiek | Koper en Brons"},{"id":7,"name":"Antiek | Lampen"},{"id":1504,"name":"Antiek | Meubels | Bedden"},{"id":5,"name":"Antiek | Meubels | Kasten"},{"id":1505,"name":"Antiek | Meubels | Stoelen en Banken"},{"id":1506,"name":"Antiek | Meubels | Tafels"},{"id":1101,"name":"Antiek | Naaimachines"},{"id":10,"name":"Antiek | Porselein"},{"id":1102,"name":"Antiek | Religie"},{"id":1103,"name":"Antiek | Schalen"},{"id":2662,"name":"Antiek | Schoolplaten"},{"id":1843,"name":"Antiek | Servies compleet"},{"id":12,"name":"Antiek | Servies los"},{"id":1507,"name":"Antiek | Speelgoed"},{"id":2663,"name":"Antiek | Spiegels"},{"id":2664,"name":"Antiek | Tin"},{"id":11,"name":"Antiek | Tv's en Audio"},{"id":14,"name":"Antiek | Vazen"},{"id":1104,"name":"Antiek | Wandborden en Tegels"},{"id":1500,"name":"Antiek | Woonaccessoires"},{"id":9,"name":"Antiek | Overige"},{"id":15,"name":"Curiosa en Brocante"},{"id":1423,"name":"Diensten | Kunstenaars en Portretschilders"},{"id":2610,"name":"Diensten | Reparatie en Onderhoud"},{"id":23,"name":"Kunst | Beelden en Houtsnijwerken"},{"id":1508,"name":"Kunst | Designobjecten"},{"id":1105,"name":"Kunst | Etsen en Gravures"},{"id":27,"name":"Kunst | Litho's en Zeefdrukken"},{"id":1844,"name":"Kunst | Niet-Westerse kunst"},{"id":1846,"name":"Kunst | Schilderijen | Abstract"},{"id":25,"name":"Kunst | Schilderijen | Klassiek"},{"id":1845,"name":"Kunst | Schilderijen | Modern"},{"id":26,"name":"Kunst | Tekeningen en Foto's"},{"id":24,"name":"Kunst | Overige"}]},1:{"id":31,"name":"Audio, Tv en Foto","subs":[{"id":2035,"name":"Accu's en Batterijen"},{"id":2617,"name":"Afstandsbedieningen"},{"id":32,"name":"Bandrecorders"},{"id":1132,"name":"Beamers"},{"id":2665,"name":"Blu-ray-spelers en Blu-ray-recorders"},{"id":33,"name":"Buizenversterkers"},{"id":2036,"name":"Cassettedecks"},{"id":35,"name":"Cd-spelers"},{"id":2666,"name":"Diaprojectors"},{"id":2042,"name":"Diensten | Film- en Videobewerking"},{"id":1199,"name":"Diensten | Fotografen"},{"id":1219,"name":"Diensten | Reparaties"},{"id":1114,"name":"Dvd-spelers en Dvd-recorders"},{"id":1115,"name":"Films 8mm, 16mm en 35mm"},{"id":1360,"name":"Fotografie | Accu's en Batterijen"},{"id":480,"name":"Fotografie | Camera's | Analoog"},{"id":487,"name":"Fotografie | Camera's | Digitaal"},{"id":2667,"name":"Fotografie | Digitale fotolijstjes"},{"id":488,"name":"Fotografie | Doka Toebehoren"},{"id":1720,"name":"Fotografie | Filters"},{"id":489,"name":"Fotografie | Flitsers"},{"id":1483,"name":"Fotografie | Fotolijsten en Fotoalbums"},{"id":1721,"name":"Fotografie | Fotoprinters en Fotopapier"},{"id":1400,"name":"Fotografie | Fotostudio en Toebehoren"},{"id":1484,"name":"Fotografie | Fototassen"},{"id":493,"name":"Fotografie | Geheugenkaarten"},{"id":495,"name":"Fotografie | Lenzen en Objectieven"},{"id":497,"name":"Fotografie | Onderwatercamera's"},{"id":501,"name":"Fotografie | Professionele apparatuur"},{"id":500,"name":"Fotografie | Statieven en Balhoofden"},{"id":1722,"name":"Harddiskrecorders"},{"id":1116,"name":"Home Cinema-sets"},{"id":1106,"name":"Kabels"},{"id":37,"name":"Koptelefoons en Headsets"},{"id":38,"name":"Luidsprekers"},{"id":2668,"name":"Mediaspelers"},{"id":40,"name":"Mp3-spelers | Apple iPod"},{"id":1649,"name":"Mp3-spelers | Overige merken"},{"id":1723,"name":"Mp3-spelers | Accessoires | Apple iPod"},{"id":1452,"name":"Mp3-spelers | Accessoires | Overige merken"},{"id":2615,"name":"Mp4-spelers"},{"id":1724,"name":"Opladers"},{"id":496,"name":"Optische apparatuur | Microscopen"},{"id":502,"name":"Optische apparatuur | Telescopen"},{"id":503,"name":"Optische apparatuur | Verrekijkers"},{"id":42,"name":"Platenspelers en Pick-ups"},{"id":1117,"name":"Professionele Audio-, Tv- en Video-apparatuur"},{"id":43,"name":"Radio's"},{"id":36,"name":"Stereo-sets"},{"id":45,"name":"Tuners"},{"id":1118,"name":"Tv-decoders en Schotelantennes"},{"id":1120,"name":"Tv's | Plasma, Lcd en Led"},{"id":1121,"name":"Tv's | Overige Tv's"},{"id":1453,"name":"Tv's | Accessoires"},{"id":46,"name":"Versterkers en Receivers"},{"id":1129,"name":"Videobewakingsapparatuur"},{"id":1130,"name":"Videocamera's | Analoog"},{"id":1131,"name":"Videocamera's | Digitaal"},{"id":1133,"name":"Videospelers en Videorecorders"},{"id":47,"name":"Walkmans, Discmans en Minidiscspelers"},{"id":1725,"name":"Weerstations en Barometers"},{"id":41,"name":"Overige Audio, Tv en Foto"}]}}';

?>

I need to convert all the integers to strings, this can be done with adding double quotes (") to them. However, how would the be done? It doesn’t need to be PHP specific, notepad++ is able to use regexes to search and replace but I’m not sure if this is the right method to do this. Any help is appreciated.

  • 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-06-06T13:19:54+00:00Added an answer on June 6, 2026 at 1:19 pm
    $result = preg_replace('/(?<=[{:,])\d+(?=[:,])/', '"\\0"', $string); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XSLT code that almost does what I want: <xsl:variable name=scoredItems
I have the following code that decodes a JSON string into an array of
I have the following code, which almost works: <?php if( $_SERVER['REQUEST_METHOD'] == 'POST' )
I`m new to sql and have been stuck on the following issue for almost
I have following databases: test table1 fields: id, password, name, lastname test2 table2 fields:
I have the following regular expression that does almost everything I need: ^[a-z0-9][a-z0-9][a-z0-9]{2,62}$ What
I have the following test, with two almost identical blocks. Now i am looking
I have the following code (almost an exact copy of the Chat server example
I have almost 25000 rows in table questions and i have the following query
I have the following select statement that finishes almost instantly. declare @weekending varchar(6) set

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.