SOLVED

Problem formatting list with JSON

%3CLINGO-SUB%20id%3D%22lingo-sub-1512224%22%20slang%3D%22en-US%22%3EProblem%20formatting%20list%20with%20JSON%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1512224%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20following%20code%20in%20my%20JSON%20formatting%20file%20causes%20the%20list%20to%20disappear%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%22txtContent%22%3A%20%22%3Dif(%5B%24Medium%5D%20%3D%3D%20'In-Person'%2C%20'Reason%20for%20requesting%20in-person%3A%20'%20%2B%20%5B%24in_x002d_personjustification%5D%2C%20'')%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20remove%20%5B%24in_x002d_personjustification%5D%2C%20or%20replace%20it%20with%20text%2C%20i.e.%2C%20'%5Bin_x002d_personjustification%5D'%20the%20list%20works%20with%20the%20correct%20formatting.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20removing%20all%20records%20and%20creating%20a%20new%20one%20with%20a%20value%20in%20%5B%24in_x002d_personjustification%5D%20(column%20name%2C%20%22in-person%20justification%22)%2C%20the%20list%20still%20does%20not%20appear.%20I%20have%20seen%20this%20happen%20when%20the%20column%20name%20doesn't%20exist%20in%20the%20Sharepoint%20list%2C%20but%20that%20doesn't%20seem%20to%20be%20the%20problem%20here%2C%20unless%20I'm%20missing%20something.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1512511%22%20slang%3D%22en-US%22%3ERE%3A%20Problem%20formatting%20list%20with%20JSON%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1512511%22%20slang%3D%22en-US%22%3EUPDATE%3A%20I%20just%20tried%20creating%20a%20different%20column%20(this%20one%20I%20named%20reason)%2C%20putting%20some%20text%20in%20it%2C%20then%20changing%20the%20JSON%2C%20the%20preview%20worked%2C%20but%20when%20I%20saved%20it%2C%20I%20got%20the%20same%20problem.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1512929%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20formatting%20list%20with%20JSON%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1512929%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F723791%22%20target%3D%22_blank%22%3E%40hrt13%3C%2FA%3E%26nbsp%3Btry%26nbsp%3B%3CSPAN%3E%5B%24in_x002d_personjustification.Value%5D%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1513018%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20formatting%20list%20with%20JSON%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1513018%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F256621%22%20target%3D%22_blank%22%3E%40BB-SPDev%3C%2FA%3Ejust%20tried%20it%2C%20same%20problem.%20Thanks%20though.%20I%20realized%20I%20should%20have%20mentioned%20the%20column%20holds%20multi-line%20text%20items.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1519740%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20formatting%20list%20with%20JSON%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1519740%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F723791%22%20target%3D%22_blank%22%3E%40hrt13%3C%2FA%3EI%20just%20figured%20it%20out.%20I%20had%20to%20%22Edit%20the%20current%20view%22%20and%20check%20the%20%22Display%22%20box%20next%20to%20the%20column.%20%3CIMG%20class%3D%22lia-deferred-image%20lia-image-emoji%22%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Fhtml%2Fimages%2Femoticons%2Ffacepalm_40x40.gif%22%20alt%3D%22%3Afacepalm%3A%22%20title%3D%22%3Afacepalm%3A%22%20%2F%3E%20Hopefully%2C%20I'll%20remember%20that%20next%20time.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1520360%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20formatting%20list%20with%20JSON%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1520360%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20need%20to%20access%20the%20data%20from%20another%20column%20using%20it's%20internal%20name%20like%3A%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3E%5B%24InternalNameOfColumn%5D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20make%20sure%20that%20you%20have%20added%20all%20the%20columns%20you%20are%20using%20in%20JSON%20formatting%20in%20your%20list%20view.%20(From%20list%20view%20settings).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20title%3D%22Use%20column%20formatting%20to%20customize%20SharePoint%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fdeclarative-customization%2Fcolumn-formatting%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EUse%20column%20formatting%20to%20customize%20SharePoint%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1520776%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20formatting%20list%20with%20JSON%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1520776%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F373269%22%20target%3D%22_blank%22%3E%40ganeshsanap%3C%2FA%3Ethanks%20for%20the%20response.%20I%20was%20using%20the%20internal%20name%20for%20the%20column%2C%20but%20I%20forgot%20to%20%22display%22%20the%20column.%2C%20(as%20I%20said%20in%20my%20last%20post).%20Thanks%20for%20responding%20though.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

The following code in my JSON formatting file causes the list to disappear,

 

"txtContent": "=if([$Medium] == 'In-Person', 'Reason for requesting in-person: ' + [$in_x002d_personjustification], '')"

 

If I remove [$in_x002d_personjustification], or replace it with text, i.e., '[in_x002d_personjustification]' the list works with the correct formatting.

 

I have tried removing all records and creating a new one with a value in [$in_x002d_personjustification] (column name, "in-person justification"), the list still does not appear. I have seen this happen when the column name doesn't exist in the Sharepoint list, but that doesn't seem to be the problem here, unless I'm missing something.

6 Replies
UPDATE: I just tried creating a different column (this one I named reason), putting some text in it, then changing the JSON, the preview worked, but when I saved it, I got the same problem.

@hrt13 try [$in_x002d_personjustification.Value]

@BB-SPDevjust tried it, same problem. Thanks though. I realized I should have mentioned the column holds multi-line text items.

best response confirmed by hrt13 (Occasional Contributor)
Solution

@hrt13I just figured it out. I had to "Edit the current view" and check the "Display" box next to the column. :facepalm: Hopefully, I'll remember that next time.

You need to access the data from another column using it's internal name like: 

[$InternalNameOfColumn]

 

Also, make sure that you have added all the columns you are using in JSON formatting in your list view. (From list view settings).

 

Use column formatting to customize SharePoint 

@ganeshsanapthanks for the response. I was using the internal name for the column, but I forgot to "display" the column., (as I said in my last post). Thanks for responding though.