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

  • Home
  • SEARCH
  • 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 9105481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:07:08+00:00 2026-06-17T02:07:08+00:00

I have sample data in this form: { ID:2 Type:None Reference1:6369-545.1 Reference2:6369-545.2 Name:John Smith

  • 0

I have sample data in this form:

{
 ID:2
 Type:None
 Reference1:6369-545.1
 Reference2:6369-545.2
 Name:"John Smith Abbott"
 Extra:""
},
{
 ID:3
 Type:None
 Reference1:7854-568.1
 Reference2:6369-545.2
 Name:"Dave St. Ledger"
 Extra:""
},
{
 ID:4
 Type:None
 Reference1:8765-177.1
 Reference2:6369-545.2
 Name:"Martha Stone"
 Extra:""
},
{
 ID:6
 Type:None
 Reference1:9856-487.1
 Reference2:6369-545.2
 Name:"Peter O'Neill"
 Extra:""
},

There is a lot more records, but I’ve only put up a small sample, and changed some names.

In my opinion, this is pretty awful formatting. Its not compatible with JSON parsers in java because the fields aren’t surrounded by double quotes, and I can’t do a mass find/replace.
Also, the end of each record isn’t separated by a comma, so while I can get each record into a String[], I can’t separate them out any further. See here:

ID:2 Type:None Reference1:6369-545.1 Reference2:6369-545.2 Name:"John Smith Abbott" Extra:""}

Usually I would split() by spaces, but as there are spaces in the peoples names, that can’t be done.

I did a mass find/replace on }, to replace with }; and like I said above, I was able to separate out each record, but then couldn’t get any further. I think I might need to do more find/replace operations on this data to make it usuable. Ideally I’d like to be able to add a comma at the end of each line of data, without adding one to the existing }, and { lines.

The ultimate goal is to insert this data into the database.
Its raw text and its in this format. I can’t change the source to reformat it, but I can do whatever I want to this data, as its in a big text file.

  • 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-17T02:07:09+00:00Added an answer on June 17, 2026 at 2:07 am

    Thats not so difficult:

    Just read the file line by line:

    if you read a “{” call a readObject() method, which reads till next (including) “}”.

    In this readObject:
    You read line by line, and use String.split() with delimiter “:”;
    Such that the first is stored in a varaible key, and the value in val.

    String lineSplitted = line.split(":");
    String key = lineSplitted[0];
    String value = lineSplitted[1];
    

    Now either find the member to be set by comparing the key to all possibilities, or use reflection to get the field named “key”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form to upload image like below <form name=sample enctype=multipart/form-data action=index.php method=post
I have a sample data table(id, name, date_create) table(1, 'Iphone 4S', '2012-06-18 17:19:05') //
I have a sample data game(id, name) 1 | Avatar 2 | Angry Bids
I have the following sample data: Id Name Quantity 1 Red 1 2 Red
I have fit a simple bi-variate VAR model to this data set and I
i have this simple code to load data from other php page using get
I have this simple helper: def printe_result(data) a_var = ('<a href=http://'+data.a_value+'>A</a>' unless (data.a_value.nil? ||
I used to have this kind of simple JSON data and I could successfully
I have below sample data. AID Date Title ----- ---------- ------ 1 2011-12-12 test1
I have a TForm like this: TMyForm = class (TForm) [MyAttr('Data')] edit1: TEdit; private

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.