How can I import a JSON file encoded in UTF-8 in SQL Server, preserving the international characters,...
up vote
0
down vote
favorite
I tried to import json file into sql server using OPENJSON function but it returned with garbled characters. JSON data file encoded with UTF-8. Is there any parameters to use within the SQL query for this issue?
USE CreateTableJSON;
GO
INSERT INTO movies
SELECT movies2.*
FROM OPENROWSET (BULK 'C:UsersMañanasourcereposWebApplication3WebApplication3JSONDeep Impact.json', SINGLE_CLOB) as j
CROSS APPLY OPENJSON(BulkColumn)
WITH( Title nvarchar(MAX), Year int, Rated nvarchar(MAX),
Released nvarchar(MAX), Runtime nvarchar(100), Genre nvarchar(MAX),
Director nvarchar(MAX), Writer nvarchar(MAX), Actors nvarchar(MAX),
Plot nvarchar(MAX), Language nvarchar(MAX), Country nvarchar(MAX),
Awards nvarchar(MAX), Poster nvarchar(MAX), Ratings nvarchar(MAX),
Metascore int, imdbRating float, imdbVotes nvarchar(MAX), imdbID nvarchar(MAX),
Type nvarchar(MAX), DVD nvarchar(MAX), BoxOffice nvarchar(MAX),
Production nvarchar(MAX), Website nvarchar(MAX), Response nvarchar(MAX)
) AS movies2
GO
I found another related question that was not answered here.
EDIT
Here is a sample JSON:
{"Title":"Deep Impact","Year":"1998","Rated":"PG-13","Released":"08 May 1998","Runtime":"120 min","Genre":"Action, Drama, Romance","Director":"Mimi Leder","Writer":"Bruce Joel Rubin, Michael Tolkin","Actors":"Robert Duvall, Téa Leoni, Elijah Wood, Vanessa Redgrave","Plot":"Unless a comet can be destroyed before colliding with Earth, only those allowed into shelters will survive. Which people will survive?","Language":"English","Country":"USA","Awards":"5 wins & 14 nominations.","Poster":"https://m.media-amazon.com/images/M/MV5BYTUwMTY1YmMtN2U5NC00YjkzLTg0YWQtZmEwNTEzZjdkNzQ2XkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"6.2/10"},{"Source":"Rotten Tomatoes","Value":"45%"},{"Source":"Metacritic","Value":"40/100"}],"Metascore":"40","imdbRating":"6.2","imdbVotes":"147,487","imdbID":"tt0120647","Type":"movie","DVD":"15 Dec 1998","BoxOffice":"N/A","Production":"Paramount Pictures","Website":"N/A","Response":"True"}
json sql-server utf-8 import character-encoding
New contributor
add a comment |
up vote
0
down vote
favorite
I tried to import json file into sql server using OPENJSON function but it returned with garbled characters. JSON data file encoded with UTF-8. Is there any parameters to use within the SQL query for this issue?
USE CreateTableJSON;
GO
INSERT INTO movies
SELECT movies2.*
FROM OPENROWSET (BULK 'C:UsersMañanasourcereposWebApplication3WebApplication3JSONDeep Impact.json', SINGLE_CLOB) as j
CROSS APPLY OPENJSON(BulkColumn)
WITH( Title nvarchar(MAX), Year int, Rated nvarchar(MAX),
Released nvarchar(MAX), Runtime nvarchar(100), Genre nvarchar(MAX),
Director nvarchar(MAX), Writer nvarchar(MAX), Actors nvarchar(MAX),
Plot nvarchar(MAX), Language nvarchar(MAX), Country nvarchar(MAX),
Awards nvarchar(MAX), Poster nvarchar(MAX), Ratings nvarchar(MAX),
Metascore int, imdbRating float, imdbVotes nvarchar(MAX), imdbID nvarchar(MAX),
Type nvarchar(MAX), DVD nvarchar(MAX), BoxOffice nvarchar(MAX),
Production nvarchar(MAX), Website nvarchar(MAX), Response nvarchar(MAX)
) AS movies2
GO
I found another related question that was not answered here.
EDIT
Here is a sample JSON:
{"Title":"Deep Impact","Year":"1998","Rated":"PG-13","Released":"08 May 1998","Runtime":"120 min","Genre":"Action, Drama, Romance","Director":"Mimi Leder","Writer":"Bruce Joel Rubin, Michael Tolkin","Actors":"Robert Duvall, Téa Leoni, Elijah Wood, Vanessa Redgrave","Plot":"Unless a comet can be destroyed before colliding with Earth, only those allowed into shelters will survive. Which people will survive?","Language":"English","Country":"USA","Awards":"5 wins & 14 nominations.","Poster":"https://m.media-amazon.com/images/M/MV5BYTUwMTY1YmMtN2U5NC00YjkzLTg0YWQtZmEwNTEzZjdkNzQ2XkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"6.2/10"},{"Source":"Rotten Tomatoes","Value":"45%"},{"Source":"Metacritic","Value":"40/100"}],"Metascore":"40","imdbRating":"6.2","imdbVotes":"147,487","imdbID":"tt0120647","Type":"movie","DVD":"15 Dec 1998","BoxOffice":"N/A","Production":"Paramount Pictures","Website":"N/A","Response":"True"}
json sql-server utf-8 import character-encoding
New contributor
Welcome to Stack Overflow; can you please post a sample of json file you want to import?
– Andrea
11 hours ago
Hi, @Andrea. I've added a sample JSON file.
– d703732
10 hours ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I tried to import json file into sql server using OPENJSON function but it returned with garbled characters. JSON data file encoded with UTF-8. Is there any parameters to use within the SQL query for this issue?
USE CreateTableJSON;
GO
INSERT INTO movies
SELECT movies2.*
FROM OPENROWSET (BULK 'C:UsersMañanasourcereposWebApplication3WebApplication3JSONDeep Impact.json', SINGLE_CLOB) as j
CROSS APPLY OPENJSON(BulkColumn)
WITH( Title nvarchar(MAX), Year int, Rated nvarchar(MAX),
Released nvarchar(MAX), Runtime nvarchar(100), Genre nvarchar(MAX),
Director nvarchar(MAX), Writer nvarchar(MAX), Actors nvarchar(MAX),
Plot nvarchar(MAX), Language nvarchar(MAX), Country nvarchar(MAX),
Awards nvarchar(MAX), Poster nvarchar(MAX), Ratings nvarchar(MAX),
Metascore int, imdbRating float, imdbVotes nvarchar(MAX), imdbID nvarchar(MAX),
Type nvarchar(MAX), DVD nvarchar(MAX), BoxOffice nvarchar(MAX),
Production nvarchar(MAX), Website nvarchar(MAX), Response nvarchar(MAX)
) AS movies2
GO
I found another related question that was not answered here.
EDIT
Here is a sample JSON:
{"Title":"Deep Impact","Year":"1998","Rated":"PG-13","Released":"08 May 1998","Runtime":"120 min","Genre":"Action, Drama, Romance","Director":"Mimi Leder","Writer":"Bruce Joel Rubin, Michael Tolkin","Actors":"Robert Duvall, Téa Leoni, Elijah Wood, Vanessa Redgrave","Plot":"Unless a comet can be destroyed before colliding with Earth, only those allowed into shelters will survive. Which people will survive?","Language":"English","Country":"USA","Awards":"5 wins & 14 nominations.","Poster":"https://m.media-amazon.com/images/M/MV5BYTUwMTY1YmMtN2U5NC00YjkzLTg0YWQtZmEwNTEzZjdkNzQ2XkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"6.2/10"},{"Source":"Rotten Tomatoes","Value":"45%"},{"Source":"Metacritic","Value":"40/100"}],"Metascore":"40","imdbRating":"6.2","imdbVotes":"147,487","imdbID":"tt0120647","Type":"movie","DVD":"15 Dec 1998","BoxOffice":"N/A","Production":"Paramount Pictures","Website":"N/A","Response":"True"}
json sql-server utf-8 import character-encoding
New contributor
I tried to import json file into sql server using OPENJSON function but it returned with garbled characters. JSON data file encoded with UTF-8. Is there any parameters to use within the SQL query for this issue?
USE CreateTableJSON;
GO
INSERT INTO movies
SELECT movies2.*
FROM OPENROWSET (BULK 'C:UsersMañanasourcereposWebApplication3WebApplication3JSONDeep Impact.json', SINGLE_CLOB) as j
CROSS APPLY OPENJSON(BulkColumn)
WITH( Title nvarchar(MAX), Year int, Rated nvarchar(MAX),
Released nvarchar(MAX), Runtime nvarchar(100), Genre nvarchar(MAX),
Director nvarchar(MAX), Writer nvarchar(MAX), Actors nvarchar(MAX),
Plot nvarchar(MAX), Language nvarchar(MAX), Country nvarchar(MAX),
Awards nvarchar(MAX), Poster nvarchar(MAX), Ratings nvarchar(MAX),
Metascore int, imdbRating float, imdbVotes nvarchar(MAX), imdbID nvarchar(MAX),
Type nvarchar(MAX), DVD nvarchar(MAX), BoxOffice nvarchar(MAX),
Production nvarchar(MAX), Website nvarchar(MAX), Response nvarchar(MAX)
) AS movies2
GO
I found another related question that was not answered here.
EDIT
Here is a sample JSON:
{"Title":"Deep Impact","Year":"1998","Rated":"PG-13","Released":"08 May 1998","Runtime":"120 min","Genre":"Action, Drama, Romance","Director":"Mimi Leder","Writer":"Bruce Joel Rubin, Michael Tolkin","Actors":"Robert Duvall, Téa Leoni, Elijah Wood, Vanessa Redgrave","Plot":"Unless a comet can be destroyed before colliding with Earth, only those allowed into shelters will survive. Which people will survive?","Language":"English","Country":"USA","Awards":"5 wins & 14 nominations.","Poster":"https://m.media-amazon.com/images/M/MV5BYTUwMTY1YmMtN2U5NC00YjkzLTg0YWQtZmEwNTEzZjdkNzQ2XkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"6.2/10"},{"Source":"Rotten Tomatoes","Value":"45%"},{"Source":"Metacritic","Value":"40/100"}],"Metascore":"40","imdbRating":"6.2","imdbVotes":"147,487","imdbID":"tt0120647","Type":"movie","DVD":"15 Dec 1998","BoxOffice":"N/A","Production":"Paramount Pictures","Website":"N/A","Response":"True"}
json sql-server utf-8 import character-encoding
json sql-server utf-8 import character-encoding
New contributor
New contributor
edited 10 hours ago
New contributor
asked Nov 8 at 8:26
d703732
11
11
New contributor
New contributor
Welcome to Stack Overflow; can you please post a sample of json file you want to import?
– Andrea
11 hours ago
Hi, @Andrea. I've added a sample JSON file.
– d703732
10 hours ago
add a comment |
Welcome to Stack Overflow; can you please post a sample of json file you want to import?
– Andrea
11 hours ago
Hi, @Andrea. I've added a sample JSON file.
– d703732
10 hours ago
Welcome to Stack Overflow; can you please post a sample of json file you want to import?
– Andrea
11 hours ago
Welcome to Stack Overflow; can you please post a sample of json file you want to import?
– Andrea
11 hours ago
Hi, @Andrea. I've added a sample JSON file.
– d703732
10 hours ago
Hi, @Andrea. I've added a sample JSON file.
– d703732
10 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
d703732 is a new contributor. Be nice, and check out our Code of Conduct.
d703732 is a new contributor. Be nice, and check out our Code of Conduct.
d703732 is a new contributor. Be nice, and check out our Code of Conduct.
d703732 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203878%2fhow-can-i-import-a-json-file-encoded-in-utf-8-in-sql-server-preserving-the-inte%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Welcome to Stack Overflow; can you please post a sample of json file you want to import?
– Andrea
11 hours ago
Hi, @Andrea. I've added a sample JSON file.
– d703732
10 hours ago