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"}









share|improve this question









New contributor




d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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















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"}









share|improve this question









New contributor




d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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













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"}









share|improve this question









New contributor




d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question









New contributor




d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 10 hours ago





















New contributor




d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 8 at 8:26









d703732

11




11




New contributor




d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






d703732 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • 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










  • 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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






d703732 is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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





































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.










 

draft saved


draft discarded


















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.















 


draft saved


draft discarded














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




















































































Popular posts from this blog

Schultheiß

Verwaltungsgliederung Dänemarks

Liste der Kulturdenkmale in Wilsdruff