I am having some troubles importing a json file to R with the following format:
C135-HR2459 {"number_a": 1, "number_b":2}
C156-HR2249 {"number_a": 1, "number_b":2}
It would have worked if it had the following format:
{"id": C135-HR2459, "number_a": 1, "number_b":2}
{"id": C156-HR2249, "number_a": 1, "number_b":2}
Using Notepad++, you can do:
^(\S+) {
{"id": "$1",
. matches newline
Explanation:
^ # beginning of line
(\S+) # group 1, 1 or more non space character; you can use (.+?) if the string contains spaces
# 1 space
{ # open curly brace
Replacement:
{"id": " # literally
$1 # content of group 1
", # literally, there is a space after the comma
Screenshot (before):
Screenshot (after):